Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler allows async function expressions in ES3/ES5 #7334

Closed
yortus opened this issue Mar 2, 2016 · 2 comments
Closed

Compiler allows async function expressions in ES3/ES5 #7334

yortus opened this issue Mar 2, 2016 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@yortus
Copy link
Contributor

yortus commented Mar 2, 2016

TypeScript Version:

1.8

Code

// file: index.ts
declare class Promise<T> {/***/}
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
let bar = async function () { return 42; } // OK, but should be an error
let baz = async () => 42; // OK, but should be an error

// file: tsconfig.json
{
    "compilerOptions": {
        "target": "es5"
    }
}

Expected behavior:
The bar and baz lines should also get error TS1311 'Async functions are only available in ES6 or higher'.

Actual behavior:
The bar and baz lines compile without errors.

@zpdDG4gta8XKpMCd
Copy link

#8581 might me related

@zpdDG4gta8XKpMCd
Copy link

also might relate: #8584

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants