Skip to content

[typescript-estree]: await in non-async function parses without error #987

Closed
@kaicataldo

Description

@kaicataldo

What code were you trying to parse?

function foo() {
  const bar = await baz();
}

AST Explorer link

What did you expect to happen?
Both espree and babel-eslint throw a parsing error when using await inside a non-async function. Should typescript-estree also throw an error here? It looks like an error is highlighted in the TypeScript Playground.

What actually happened?
Parses without error.

Versions

"@typescript-eslint/eslint-plugin": "^2.3.0",
"@typescript-eslint/parser": "^2.3.0",
"eslint": "^6.4.0",
"typescript": "^3.6.3"
package version
@typescript-eslint/typescript-estree 2.3.0
TypeScript 3.6.3
node 10.16.3
npm 6.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions