which makes sense as nothing prevents you to write options.notation = 'foo'. I think you fall into the trap of thinking that const means immutable, but it rather means "cannot be reassigned".
The alternative to help TypeScript here with the as const is to just tell it the right interface in the assignment.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I don't want to go into all of your issues. So I stop at the first one since no one mentioned this:
Solves your problem here. By default, TS makes / types these objects loosely, as such at it sees
which makes sense as nothing prevents you to write
options.notation = 'foo'
. I think you fall into the trap of thinking thatconst
means immutable, but it rather means "cannot be reassigned".The alternative to help TypeScript here with the
as const
is to just tell it the right interface in the assignment.