TypeScript · Junior · Question 75 of 75
Why is @ts-expect-error safer than @ts-ignore?
- ✓Correct answer:
@ts-expect-erroritself errors when the next line no longer has an error, so stale suppressions get noticed - 2
@ts-ignoreis removed in strict mode - 3
@ts-expect-errorfixes the error automatically
Explanation
Both silence the next line. Add a comment explaining why, and prefer fixing types where possible.