Martijn Eikelenboom Martijn Eikelenboom - 1 month ago 15
TypeScript Question

Typescript 2.0 no output

I'm coding a project in VS 2015 update 3 and just installed Typescript 2.0.

After a lot of errors I've been on a trail and error mission to get it working again. Now I don't have any errors anymore, but I'm not getting my output file.

My source files are all in the client folder, and that folder is in the root of the project.

This is my tsconfig.json:

{
"compileOnSave": true,
"compilerOptions": {
"module": "amd",
"noImplicitAny": true,
"noEmitOnError": true,
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"target": "es5",
"outDir": "./client",
"outFile": "./client/app.js",
"sourceRoot": "./client"
},
"exclude": [
"node_modules",
"wwwroot"
]
}


The project did compile when it was on version 1.8.x.

This is an example of one of my .ts files:

namespace app {
'use strict';

angular
.module('app', [
'ngRoute',
'ngAnimate',
'officeuifabric.core',
'officeuifabric.components'
]);

}


Am I missing something?

---edit---
If I remove these lines:

"outDir": "./client",
"outFile": "./client/app.js",
"sourceRoot": "./client"


it builds without an issue. Are the parameters still supported?

--edit 2--
I've also been testing with an empty project an VS Code and the command line tsc.

My tsconfig that's working:

{
"compileOnSave": true,
"compilerOptions": {
"module": "amd",
"noImplicitAny": true,
"noEmitOnError": true,
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"target": "es5",
"outFile": "app.js",
"sourceRoot": "./client"
},
"exclude": [
"node_modules"
]
}


However when I add Outdir, either nothing is compiled, or at the wrong location.

This does work:

"outFile": "./build/app.js",

Answer

This config is working for me:

{
  "compileOnSave": false,
  "compilerOptions": {
    "module": "amd",
    "noImplicitAny": true,
    "noEmitOnError": true,
    "moduleResolution": "node",
    "removeComments": true,
    "sourceMap": true,
    "target": "es5",
    "outFile": "./build/app.js"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}