How can I generate a tsconfig.json
via the command line?
I tried command tsc init
, but this doesn\'t work.
Setup a ts project as following steps:
yarn global add typescript
yarn init
or setting defaults yarn init -yp
tsc --init
The project structure seems like:
│ package.json
│ tsconfig.json
│ tslint.json
│ yarn.lock
│
├─dist
│ index.js
│
└─src
index.ts
I recommend to uninstall typescript first with the command:
npm uninstall -g typescript
then use the chocolatey package in order to run:
choco install typescript
in PowerShell.
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.