I have seen this issue explained from Bobby Hadz for arrays of the same type, but I cannot find anythinjg about objects that contain different types.
Here is the error that is produced. Type 'string | number | boolean' is not assignable to type 'never'. Type 'string' is not assignable to type 'never'.
Here is the code that causes the TS error.
const geometryCopy : geometryTypes = {... geometryValues}
//Append the new value to the object
if(geometryCopy?.[attributeName]) geometryCopy[attributeName] = newValue
attributeName has its type as keyof geometryType.
Any help would be greatly appreciated on how to resolve the issue or any best practices that I am not following.
Edit: I have recreated the error on this ts playground.