Top-level await

WebStorm marks top-level `await` as invalid. This is correct in most cases, but not for files loaded using await-top. How do I fix this?

0

This is a syntax error; such errors can't be suppressed, these are low-level checks done at lexer level. You need to disable highlighting for your files to get rid of it. This can be done using Hector icon in the lower right corner: open your file in editor, click the Hector icon and then move the slider to change the Highlighting level to None. See https://www.jetbrains.com/help/webstorm/changing-highlighting-level-for-the-current-file.html. You will likely need to reopen the project to get the highlighting updated.

1
Avatar
Permanently deleted user

Hey, now that top-level await was landed in V8 (and will be shipped in main-line Node soon), I'd like to warm this request up again.

0

Since 2019.2, we have a separate inspection for this, JavaScript | General | The 'await' operator can only be used in an 'async' function. It's ON by default, but can be disabled in Settings | Editor | Inspections

1
Avatar
Permanently deleted user

That definitely works, thanks for the quick reply!

0

请先登录再写评论。