Skip to content

cyclic dependency and main/module package.json breaks structural typing #28807

@AlexGalays

Description

@AlexGalays

TypeScript Version: 3.2.1

Code

See this repository reproducing the issue: https://github.com/AlexGalays/repro-ts-bug-module-duck

Just call yarn and check index.ts.

Expected behavior:

It should compile

Actual behavior:
With the introduction of a cycle in the lib modules (Option.toResult, and Result.toOption)
an Option from the /es folder is no longer compatible with an Option from the /commonjs folder (which is the reference for typings in package.json) even though they are structurally identical.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions