I am working with the excellent Express/Node/Typescript example code found here. It transpiles the .ts code with the following command from run.sh:
./node_modules/.bin/tsc --sourcemap --module commonjs ./bin/www.ts
This works as advertised, but I would prefer to use a tsconfig.json file and tsc -p .
However, when I run that command I get a raft of TS2300: Duplicate identifier 'foo' errors
when tsc
(erroneously?) tries to walk the ./node_modules
and ./typings
directories. Below is the tsconfig.json I am using:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings"
]
}
Any ideas? I am using tsc 1.7.3 FWIW.
I did:
git clone https://github.com/czechboy0/Express-4x-Typescript-Sample.git
cd Express-4x-Typescript-Sample/
./run.sh
tsd install # I don't know why, but this helped me.
./run.sh
I created Express-4x-Typescript-Sample/tsconfig.json
file with content
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings"
]
}
I ran
[...]/Express-4x-Typescript-Sample$ tsc -p .
and it works work me - i.e. there are no errors.