✍ by @JoshuaKGoldberg.com; 🖨 by O'Reilly
https://learningtypescript.com
If you'd like to learn more, see the blog post at the top of this thread: www.learningtypescript.com/articles/com...
Got your own TypeScript Qs? Ask and I'll be happy to answer. 💙
Thanks for reading!
11/11
If you'd like to learn more, see the blog post at the top of this thread: www.learningtypescript.com/articles/com...
Got your own TypeScript Qs? Ask and I'll be happy to answer. 💙
Thanks for reading!
11/11
typescript-eslint.io/troubleshoot...
10/🧵
typescript-eslint.io/troubleshoot...
10/🧵
@typescript-eslint.io's `@typescript-eslint/ban-ts-comment` reports if you:
* use a ts-ignore or ts-nocheck directive
* forget to attach an explanation >3 characters on a ts-expect-error directive
Use linting to enforce and teach best practices. 🧠
9/🧵
@typescript-eslint.io's `@typescript-eslint/ban-ts-comment` reports if you:
* use a ts-ignore or ts-nocheck directive
* forget to attach an explanation >3 characters on a ts-expect-error directive
Use linting to enforce and teach best practices. 🧠
9/🧵
First, put explanations with your comment directives. These will help future developers understand why you had to use them - and show that they're not to be used willy-nilly.
8/🧵
First, put explanations with your comment directives. These will help future developers understand why you had to use them - and show that they're not to be used willy-nilly.
8/🧵
7/🧵
7/🧵
But, it can be handy if you don't have the time to convert a large existing file to TypeScript.
6/🧵
But, it can be handy if you don't have the time to convert a large existing file to TypeScript.
6/🧵
5/🧵
5/🧵
* Disables type checking on a line
* Reports a type error if the comment isn't suppressing any
Being told when a comment directive can be removed helps with long-term code cleanliness.
4/🧵
* Disables type checking on a line
* Reports a type error if the comment isn't suppressing any
Being told when a comment directive can be removed helps with long-term code cleanliness.
4/🧵
Sometimes the type checker can be wrong. Types can be incorrect, or there can be a bug or missing feature.
If an `any` isn't enough, a comment directive might be.
3/🧵
Sometimes the type checker can be wrong. Types can be incorrect, or there can be a bug or missing feature.
If an `any` isn't enough, a comment directive might be.
3/🧵
The most common are `@ts-expect-error` & `@ts-ignore`, which disable type checking for a line.
2/🧵
The most common are `@ts-expect-error` & `@ts-ignore`, which disable type checking for a line.
2/🧵