Search code examples
typescripttsconfig

Print version of TypeScript


I have following tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "ES5",
    "sourceMap": true,
    "module": "system",
    "moduleResolution": "node",
    "alwaysStrict": true,
    "version": true
  },
  "exclude": [
    "**/*.d.ts"
  ]
}

and looking at https://www.typescriptlang.org/docs/handbook/compiler-options.html --version flat should print version of TypeScript but it does not work. Why?


Solution

  • --version is one of several special-purpose options that only works on the command line, not in tsconfig.json. It makes the compiler print the version instead of compiling your code, so having the option permanently enabled in tsconfig.json wouldn't be very useful anyway.