How can I generate a tsconfig.json file?
It is supported since the release of TypeScript 1.6.
The correct command is --init
not init
:
$ tsc --init
Try to run in your console the following to check the version:
$ tsc -v
If the version is older than 1.6 you will need to update:
$ npm install -g typescript
Remember that you need to install node.js to use npm.
For those who have TypeScript installed as a local package (and possibly as a dev dependency) via:
$ npm install typescript --save-dev
...and who have added tsc script to package.json:
"scripts": {
...
"tsc": "tsc"
},
You can call tsc --init
via npm
:
$ npm run tsc -- --init