Languages
[Edit]
EN

TypeScript - compile *.ts files without emitting result (without creating *.js files)

26 points
Created by:
Imaan-Morin
649

In this short article, we would like to show how to compile TypeScript files without emitting *.js files.

The below approach is useful when we want to check/validate the correctness of *.ts files.

Quick solution (run in console):

tsc --noEmit

or

tsc --project path/to/tsconfig.json --noEmit

 

Example usage

In this section, we want to show example when tsc returned incorrect import path message.

john@ubuntu-pc:~/Desktop/Projects/shop$ npx tsc --project ./tsconfig.json --noEmit

Example output:

../commons/src/components/NavBar.tsx:1:24 - error TS2307: Cannot find module './BlueButton' or its corresponding type declarations.

Found 1 error.

TypeScript

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join