In my configuration file, tsconfig looks like this:
{
"compilerOptions": {
"module": "esnext",
"target": "es6",
"declaration": true,
"outDir": "./dist",
},
"include": [
"src/**/*"
]
}
Let's consider a simple source file for example:
// ./src/index.ts
function hello() {
return 'hello';
}
Unexpectedly, an error message pops up:
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
../../../node_modules/@types/node/index.d.ts:166:11
166 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
The confusion arises as to why it checks
../../../node_modules/@types/node/index.d.ts:166:11
when only src
is included?
This issue doesn't occur with the usage of "module": "commonjs"
.