I'd like to make vscode to show warning when I do not annotate type even if typescript infer type correctly (I'm not talking of noImplicitAny option).
Is there an option in tsconfig that could allow me to have this behavior ?
I'd like to make vscode to show warning when I do not annotate type even if typescript infer type correctly (I'm not talking of noImplicitAny option).
Is there an option in tsconfig that could allow me to have this behavior ?
Copyright © 2021 Jogjafile Inc.
TypeScript itself doesn't have a setting that will warn you if you don't annotate a variable whose type can be inferred. The only time such things are considered a problem in the language is if the inference fails and the type implicitly falls back to the
anytype.For functionality like this, you might want to use a linter like ESLint with a rule like
@typescript-eslint/typedef, whose description readsNote: this is not necessarily recommended: the official TS handbook about annotations implies that you should normally just rely on the inferred types, and even the ESLint rule linked above says :