We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5233d73 commit 891e0b4Copy full SHA for 891e0b4
crates/oxc_parser/src/ts/types.rs
@@ -1028,6 +1028,9 @@ impl<'a> ParserImpl<'a> {
1028
let source = if self.at(Kind::Str) {
1029
self.parse_literal_string()
1030
} else {
1031
+ // `StringLiteral` is the only valid type for `TSImportType`'s `source` field. So this is an error.
1032
+ // Fallback to parsing a `TSType`, to obtain a good span for the diagnostic.
1033
+ // It's possible for `parse_ts_type` to produce an invalid span. Fallback to the current token span if so.
1034
let mut span = self.parse_ts_type().span();
1035
if span.end <= span.start {
1036
span = self.cur_token().span();
0 commit comments