Languages
[Edit]
EN

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

26 points
Created by:
Imaan-Morin
1009

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.

 

Alternative titles

  1. TypeScript - verify project files
  2. TypeScript - example of --noEmit parameter usage
  3. TypeScript - check files correctness
  4. TypeScript - compile files without saving output
  5. TypeScript - check files imports
  6. TypeScript - verify project syntax
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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