so I just went with isBlurred: 0 | 1 and when using it, I cast Number(isBlurred). While it works, on CR I was asked why I chose this solution and had to explain that I couldn't make this work with type intersections either, because the type checker was complaining.
Solving this is another question, but I think a good clarification in the error translator would be very useful to start the process with.
Error Text
Property 'isBlurred' of type 'boolean' is not assignable to 'string' index type 'number'.
Supporting Information
Please provide other information which led to this error, and any specific questions you have about it:
I have this type:
A requirement came in to extend this with an
isBlurred: boolean
field. I figured out that I the type signature doesn't allow for the following:so I just went with
isBlurred: 0 | 1
and when using it, I cast Number(isBlurred). While it works, on CR I was asked why I chose this solution and had to explain that I couldn't make this work with type intersections either, because the type checker was complaining.Solving this is another question, but I think a good clarification in the error translator would be very useful to start the process with.