P
P
Persotr272021-03-26 00:33:43
typescript
Persotr27, 2021-03-26 00:33:43

How to check project for TypeScript typing in VS Code?

Hello.
If you edit a TypeScript project file in VS Code and make a mistake in using types, it will throw an error, that's good.
But, if we suppose to change some type (interface), and the file that refers to it (by import) and uses is closed, then no error will be given. The program will then compile and run (after all, there are no errors in the javascript itself, only typing errors that do not interfere with compilation).
How to check all project files for correct typing?
I know there are ESLint, TSLint. If that's what they're used for, please share a source on how to quickly set it up for VS Code. Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2021-03-26
@Persotr27

only typing errors that do not interfere with compilation
If the project compiles, then all types matched. If the project compiles, but there is still an error, then the types are described crookedly.
How to check all project files for correct typing?
Compile the project.
But, if we suppose to change some type (interface), and the file that refers to and uses it is closed, then no error will be given.
And this is good. If TypeScript LSP will recheck the entire project for every sneeze, and not just open files, then it will be impossible to write something more complicated than a todo list...
I know there are ESLint, TSLint.
They are also for static analysis, but for a little different. In VSCode they also only check open files, for the same performance reasons.
TSLint is deprecated. Install ESLint from here: https://marketplace.visualstudio.com/items?itemNam...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question