Skip to content

Support "function-like" import() #12933

@jmalonzo

Description

@jmalonzo

The proposal for function-like import() is currently in stage-3, and I think it'd be nice if Typescript will support it in future versions.

For example, one such project that already supports it is webpack which checks for import() as a code-splitting construct (deprecating System.import in v2 and replacing it altogether in v3).

TypeScript Version: 2.0.10

Code

// A *self-contained* demonstration of the problem follows...

import('page/profile').then(() => /* load route */ );

Expected behavior:
The compiler allows the dynamic import syntax as above.

Actual behavior:
-> error TS1128: Declaration or statement expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions