Skip to content

[Bug] Cannot default export an expression that begins with async #9531

Closed
@Seikho

Description

@Seikho

TypeScript Version: nightly (2.0.0-dev.20160705)

The changes in #9445 have caused a breaking change in my code base. This is a pattern that we use very frequently our projects.
The compiled output has also changed and no longer functions as expected. The same error also occurs when using the async library in the same way (e.g. export default async.map(...))

Code

import {async,await} from 'asyncawait';
export default async(() => await(Promise.resolve(1)));

should compile without error and emit:

const asyncawait_1 = require('asyncawait');
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = asyncawait_1.async(() => asyncawait_1.await(Promise.resolve(1)));

but incorrectly emits:

const asyncawait_1 = require('asyncawait');
asyncawait_1.async(() => asyncawait_1.await(Promise.resolve(1)));

Expected behavior:
Compiles without error
Actual behavior:
[ts] Declaration expected
Incorrect compiled output

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