-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 4.1.2
Search Terms: javascript, javascript declaration, eventemitter (and bunch of others)
Code
import { EventEmitter } from 'events';
export default class Foo extends EventEmitter {}
With tsconfig:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"allowJs": true,
"checkJs": true,
"outDir": "./dist",
"declaration": true,
"strict": false,
"rootDir": "./src"
},
"include": [
"src/*.js",
"src/**/*.js"
]
}
Expected behavior:
The generated declaration file should contain:
import { EventEmitter } from "events"
export default class Flowtrace extends EventEmitter {}
Actual behavior:
import { EventEmitter } from "node/events"
export default class Flowtrace extends EventEmitter {}
Which produces the following error:
File '/node_modules/@types/node/events.d.ts' is not a module.ts(2306)
For now the fix appears to be to search-and-replace the node/events
instances.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue