TIL: don't ignore, expect error
Last updated: Jun 20, 2022We’ve all been there. You want to get something running but Typescript is complaining about code that you’re not sure how to fix yet. So you just ignore it.
Today I listened to JS Party’s episode on ESlint and Typescript with Josh Goldberg and learned about @ts-expect-error
. Instead of simply ignoring it and ending up with some stale @ts-ignore
comments in our codebase, we can just tell Typescript to expect that the code will have an error. This way, once the code doesn’t have any issues anymore, Typescript will let us know we can remove the comment!