-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.0.3 from npm
Code
I've got the following project structure setup
@types/
-- events
---- index.d.ts
node_modules/
-- @types
-----react, react-dom etc
utils/
-- eventEmitter.js
tsconfig.json
In my tsconfig.json I have:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"jsx": "react",
"allowJs": true,
"sourceMap": true,
"typeRoots" : [
"./@types"
],
"types" : [
"events",
"ajax",
"path",
"keymirror"
]
},
"exclude" : [
"node_modules",
"@types"
]
}
in eventEmitter.js I have the following:
import * as events from "events";
Actual Behaviour:
When I try and compile with the file structure above, I get the following error
ERROR in ./utils/eventEmitter.ts
(1,25): error TS2307: Cannot find module 'events'.
However, if I move ./@types/events/index.d.ts to ./node_modules/@types/events/index.d.ts everything works as expected and the eventEmitter will compile
Expected behaviour:
Using the above configuration I would expect the compiler to pick up on my custom definitions which are in ./@types in the same way it does when the same definitions are in the node_modules/@types folder
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created