Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
102
rated 0 times [  109] [ 7]  / answers: 1 / hits: 22523  / 5 Years ago, wed, july 10, 2019, 12:00:00

I was making my first typescript-node-express application.



To start with, I created my own tsconfig file which looks like



{
compilerOptions: {
target: es6,
module: commonjs,
strict: true,
baseUrl: ./,
outDir: ./build,
sourceMap: true,
experimentalDecorators: true,
emitDecoratorMetadata: true,
importHelpers: true,
types: [
node
],
typeRoots: [
node_modules/@types
],
include: [
src/**/*.ts
],
exclude: [
node_modues
]
}
}


And inside my src/app.ts I am initialising my express app



import * as express from express;

class App {

constructor() {
this.app = express();
}

//TODO: What is public app: express.Application
public app: express.Application;

}

const app = new App().app;
const port = 4040;

app.listen(port, function() {
console.log('Express server listening on port ' + port);
});


Now, When I do ts-node ./src/app.ts I am getting the following error




error TS5023: unknown compiler option 'include'.



error TS5023: unknown compiler option 'exclude'.



at createTSError (/Users/an/.nvm/versions/node/v10.15.3/lib/node_modules/ts-node/src/index.ts:245:12)
at reportTSError (/Users/an/.nvm/versions/node/v10.15.3/lib/node_modules/ts-node/src/index.ts:249:19)
at Object.register (/Users/an/.nvm/versions/node/v10.15.3/lib/node_modules/ts-node/src/index.ts:260:36)
at Object.<anonymous> (/Users/an/.nvm/versions/node/v10.15.3/lib/node_modules/ts-node/src/bin.ts:120:17)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)Unknown compiler



Can someone help me figure out why I am getting this error?


More From » node.js

 Answers
35

According to the handbook, include and exclude are supposed to be siblings of compilerOptions, not children:



{
compilerOptions: {
target: es6,
module: commonjs,
strict: true,
baseUrl: ./,
outDir: ./build,
sourceMap: true,
experimentalDecorators: true,
emitDecoratorMetadata: true,
importHelpers: true,
types: [
node
],
typeRoots: [
node_modules/@types
]
},
include: [
src/**/*.ts
],
exclude: [
node_modues
]
}

[#51904] Tuesday, July 2, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elijahm

Total Points: 674
Total Questions: 124
Total Answers: 79

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;