Skip to content

Circular dependency in Typescript doesn't work #850

@gamelaster

Description

@gamelaster

Expected Behavior

The decorator should print undefined, and continue (and it later usage, the reference should be correct)

Actual Behavior

Decorator throws error, since it tries directly to use Class1 before initialization

Additional Information

This is very simple showcase of circular dependency problem,
although, this have little back story.
I'm trying to use Sapper, together with TypeORM.
The way that TypeORM makes one-to-one relation,
it makes a circular dependency. Although, in this case, it's correct and in app run directly by TypeScript,
it works fine. Although, when using it with rollup, same issue happening as in this REPL.

Please, let me know if this should be assigned directly to rollup (not the plugin), or if it's possible to solve it
through some rollup configuration. I invested several hours of searching for solution, although, after all
I decided to post it as bug here to this plugin.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions