-
-
Notifications
You must be signed in to change notification settings - Fork 722
Open
Labels
Description
await new Promise(resolve => {}) cannot be parsed with ModuleKind::Unambiguous.
This is allowed by babel.
Babel REPL (strict is enabled, so that means it's parsing in module mode)
Related code:
oxc/crates/oxc_parser/src/lib.rs
Lines 481 to 487 in ecdda9e
| if source_type.is_unambiguous() { | |
| program.source_type = if module_record.has_module_syntax { | |
| source_type.with_module(true) | |
| } else { | |
| source_type.with_script(true) | |
| }; | |
| } |
(we may need to add a separate flag for TLA as whether TLA is a module syntax can be controversial)
tsc has some logic to reparse https://github.com/microsoft/TypeScript/blob/efca03ffed10dccede4fbc8dd8a624374e5424d9/src/compiler/parser.ts#L1862
#15494 (review)