diff --git a/ecmascript/parser/src/parser/class_and_fn.rs b/ecmascript/parser/src/parser/class_and_fn.rs index 7bdffc90c2bb..7925c171a79e 100644 --- a/ecmascript/parser/src/parser/class_and_fn.rs +++ b/ecmascript/parser/src/parser/class_and_fn.rs @@ -716,7 +716,13 @@ impl<'a, I: Tokens> Parser { { // handle async foo(){} - let is_override = is_override || self.parse_ts_modifier(&["override"])?.is_some(); + if self.parse_ts_modifier(&["override"])?.is_some() { + is_override = true; + self.emit_err( + self.input.prev_span(), + SyntaxError::TS1029(js_word!("override"), js_word!("async")), + ); + } let is_generator = eat!(self, '*'); let key = self.parse_class_prop_name()?; diff --git a/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts b/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts new file mode 100644 index 000000000000..f22607ce744e --- /dev/null +++ b/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts @@ -0,0 +1,3 @@ +class C extends B { + async override fetch() {} +} \ No newline at end of file diff --git a/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts.stderr b/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts.stderr new file mode 100644 index 000000000000..067894d03b0e --- /dev/null +++ b/ecmascript/parser/tests/typescript-errors/class/override-with-async/input.ts.stderr @@ -0,0 +1,6 @@ +error: 'override' modifier must precede 'async' modifier. + --> $DIR/tests/typescript-errors/class/override-with-async/input.ts:2:9 + | +2 | async override fetch() {} + | ^^^^^^^^ +