Skip to content

Q: What is the type of a dynamic loaded es module? #22044

Closed
@bobaaaaa

Description

@bobaaaaa

I haven't find any resources for this question.

Example

// Foo.ts
export class Foo {}
export class Unused {}
// Bar.ts
export async function getFoo(): Promise<Foo> {
    // tslint:disable:no-any
    // What is the return type of a dynamic loaded es-module?
    return import('./Foo').then(({ Foo }: any): Foo => new Foo());
    // tslint:enable:no-any
}

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