Skip to content

[parser] Allow optional async methods#10582

Merged
nicolo-ribaudo merged 2 commits intobabel:masterfrom
zant:bugfix/10525
Nov 18, 2019
Merged

[parser] Allow optional async methods#10582
nicolo-ribaudo merged 2 commits intobabel:masterfrom
zant:bugfix/10525

Conversation

@zant
Copy link
Copy Markdown
Contributor

@zant zant commented Oct 21, 2019

Q                       A
Fixed Issues? Fixes #10525
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Any Dependency Changes? No
License MIT

async methods were not parsing post member name modifiers, causing ? to be an unexpected token

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also reveals an issue in modifiers parsing. i.e. the following snippet

class B { }
class A extends B {
    async? method(val: string): Promise<void>;
}

is expected to throw but currently it is parsed as an optional async method signature. We could address it in a separate PR, though.

@existentialism existentialism added pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Oct 21, 2019
@zant
Copy link
Copy Markdown
Contributor Author

zant commented Oct 21, 2019

Oh that's right @JLHwung I'll be glad to work on a follow-up PR for that 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

babel-preset-typescript failed to parse optional async method

4 participants