How to check TypeScript code for syntax errors from a command line?

Ondra Žižka picture Ondra Žižka · Jan 9, 2017 · Viewed 8.8k times · Source

I have a code that generates TypeScript classes, and as a build/test step, I would like to check the generated files for syntax correctness.

I have looked at TypeScript compiler options but see no such option.

  • How can I check the syntax?

I am looking for a tool that can be run from Maven, so ideally, a Maven plugin, or a command line tool.

I don't want a full compilation because the referred types are not reachable at that build step (they are in a different module to which the generated sources are added later).

Answer

alechill picture alechill · Jan 9, 2017

If its just syntax checking you are after then you can use a linter like tslint which can be run from the command line or via many build tools