Skip to content

5.4 breaks @types/node when using isolatedModulesΒ #57136

Closed
@nicolo-ribaudo

Description

@nicolo-ribaudo

πŸ”Ž Search Terms

isolatedModules "resolves to a type and must be marked" @types/node export import

πŸ•— Version & Regression Information

  • This changed between versions 5.3 and 5.4.0-dev.20240120

⏯ Playground Link

No response

πŸ’» Code

declare module "node:events" {
    import events = require("events");
    export = events;
}

from https://unpkg.com/browse/@types/node@20.11.5/events.d.ts (at the end)

πŸ™ Actual behavior

node_modules/@types/node/events.d.ts:878:14 - error TS1291: 'events' resolves to a type and must be marked type-only in this file before re-exporting when 'isolatedModules' is enabled. Consider using 'import type' where 'events' is imported.

878     export = events;
                 ~~~~~~

πŸ™‚ Expected behavior

It should work, as events is not just a type but also a value

Additional information about the issue

DT discussion: DefinitelyTyped/DefinitelyTyped#68285

Originally found at babel/babel#16222

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions