-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Await insert break ASI #33522
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
Comments
That wouldn't be the right thing to do because it would be parsed as |
friendly ping @andrewbranch |
My issue was open there But in fact as I am coding I am relying on the linter to add semis on save and if autocompletion add parenthesis it should also take care of not becoming continuation of previous line... await by itself or code by itself will not cause problems because of the automatic semi insertion but a set of parenthesis added on the fly change this behaviour and become continuation of previous line... in most cases it probably requires to add a semi when autocompleting with a set of parenthesis but some edge cases might implies not doing it but I am not sure why if the parenthesis would have been the continuation of previous line I assume it would have been added by the person not as a completion in that context I think |
It’s nice because now automatic completion implement not only then/catch/finally but also of the « then resolved promises » by adding an await inside a set of parenthesis then a dot and then the other possibility (async _=>{
const some:any = await a;
const something:any = some.xxx('do something')
})() now autocomplete and save you of assigning to an intermediary variable (async _=>{
const something:any = (await a).xxx('do something');
})() If you don’t need to say save to a variable/const then This ... (async _=>{
const a: Promise<any> = f()
(await a).xxx('do something') // asi broken here
})() ... is the same as this: (async _=>{
const a: Promise<any> = f()(await a).xxx('do something') // asi broken here
})() |
Hi all, sadly I’m not 100% sure what could i do.... |
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
Expected behavior:
Actual behavior:
Playground Link:
https://twitter.com/Luxcium/status/1174602967053471744
Related Issues:
The text was updated successfully, but these errors were encountered: