Skip to content

async function bug? #11376

@yortus

Description

@yortus

TypeScript Version: nightly (2.1.0-dev.20161004)

Code

// @target: es5
async function foo(): string { // OK, but should be error
    return 'foo';
}

let s = foo(); // OK, type of s is string, but should be Promise

s = s.concat('bar'); // OK, but runtime error 's.concat is not a function'

Expected behavior:
Compiler error on foo declaration about invalid return type annotation.

Actual behavior:
Compiles without errors and crashes at runtime.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA 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