Today I learned… if you are doing something naughty in JavaScript* (and let’s face it, of course you are) that TypeScript’s type checker is giving you an error for and you – being you – want to keep being naughty (because you can and that’s half the fun), there’s a better way to silence the error than using @ts-ignore which, umm, just ignores it.
Instead, you can use @ts-expect-error (with the error message, to remind yourself what you’re expecting).
This way, if the error ever goes away (which would likely signal… uh… an error), you will be notified.
So, yeah, how’s your morning going?
* Like returning a proxy from a constructor instead of an instance of the class itself.
#JavaScript #TypeScript #typeChecking #proxy #tsIgnore #tsExpectError