Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@Saulzi

Description

@Saulzi
Issue body actions

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); })];
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.