SkyWalker
SkyWalker

Reputation: 14309

How to generate a tsconfig.json that matches package.json + tsc command?

I'm using TodoMvc Typescript-Angular as blueprint for my AngularJS application. It is all good and works fine. Basically I can:

  1. Install or update all dependencies with that package.json doing npm install or npm update.
  2. Compile the ts code under js doing npm run compile which is configured to be tsc --sourcemap --out js/Application.js js/_all.ts.

I'm also working with WebStorm and would like to get the tsconfig.json equivalent to the command before ... how can I do that?

Doing tsc --init I get a new generic tsconfig.json generated but it is not the equivalent to the command tsc --sourcemap --out js/Application.js js/_all.ts ... is there a way to generate it according to a package.json setup? also taking into account the TS version there etc?

Upvotes: 1

Views: 1504

Answers (1)

lena
lena

Reputation: 93728

The following config should work:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "outFile": "js/Application.js"
    },
    "exclude": [
        "node_modules"
    ],
    "include": ["js/_all.ts"]
}

Upvotes: 1

Related Questions