Skip to content

Exported types incompatible with ESM when using TypeScript@next #6801

@AndrewLeedham

Description

@AndrewLeedham

Describe the bug

When importing rxjs in a project using TypeScript@next with the "module": "nodenext" (experimental ESM support) it fails to locate the associated types. As seen in this TypeScript playground: Playground Link.

Expected behavior

TypeScript@next is experimental so I suppose I don't expect it to work. But the API seems fairly stable, so I am raising this issue to track the change. The exports spec defines an optional types field, which if used in rxjs resolved the issue (I have tried this with a patch locally).

Reproduction code

import { Observable, Subject } from 'rxjs';

Reproduction URL

https://www.typescriptlang.org/play?target=99&moduleResolution=99&ts=4.6.0-dev.20220116#code/JYWwDg9gTgLgBAbzgeQEYGcCmUBuBDVAG0wBo4BlAV1QCtMBjeAXzgDMoIQ4ByKADxrpuAbiA

Version

7.4.0

Environment

  • Node.js@16.13.2
  • TypeScript@4.6.0-dev.20220204

Additional context

Related discussion in the TypeScript repo: microsoft/TypeScript#46452 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions