Skip to content

new import syntax incorrectly generating amd require on exported function compared to class member / exported function #16641

Closed
@Saulzi

Description

@Saulzi

TypeScript Version: 2.4.0

The following things work as expected

export class Test 
{
    async LoadSomething() {
        const something = await import("./something");
    }
}

export async function LoadSomething() {
        const something = await import("./something");
}

which will generate

new Promise(function (resolve_1, reject_1) { require(["./something"], resolve_1, reject_1); })];

whereas

    export = async function() {
        const something = await import("./something");
    }
// A *self-contained* demonstration of the problem follows...

will generate

 import("./something")

Expected behavior:
Code which is emitted should be

new Promise(function (resolve_1, reject_1) { require(["./something"], resolve_1, reject_1); })];

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions