JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], items: JsModuleItemList [ JsIfStatement { if_token: IF_KW@0..3 "if" [] [Whitespace(" ")], l_paren_token: L_PAREN@3..4 "(" [] [], test: JsBooleanLiteralExpression { value_token: TRUE_KW@4..8 "true" [] [], }, r_paren_token: R_PAREN@8..10 ")" [] [Whitespace(" ")], consequent: JsBogusStatement { items: [ JsDecoratorList [], CLASS_KW@10..16 "class" [] [Whitespace(" ")], JsIdentifierBinding { name_token: IDENT@16..18 "A" [] [Whitespace(" ")], }, L_CURLY@18..19 "{" [] [], JsClassMemberList [], R_CURLY@19..20 "}" [] [], ], }, else_clause: missing (optional), }, ], eof_token: EOF@20..21 "" [Newline("\n")] [], } 0: JS_MODULE@0..21 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 3: JS_MODULE_ITEM_LIST@0..20 0: JS_IF_STATEMENT@0..20 0: IF_KW@0..3 "if" [] [Whitespace(" ")] 1: L_PAREN@3..4 "(" [] [] 2: JS_BOOLEAN_LITERAL_EXPRESSION@4..8 0: TRUE_KW@4..8 "true" [] [] 3: R_PAREN@8..10 ")" [] [Whitespace(" ")] 4: JS_BOGUS_STATEMENT@10..20 0: JS_DECORATOR_LIST@10..10 1: CLASS_KW@10..16 "class" [] [Whitespace(" ")] 2: JS_IDENTIFIER_BINDING@16..18 0: IDENT@16..18 "A" [] [Whitespace(" ")] 3: L_CURLY@18..19 "{" [] [] 4: JS_CLASS_MEMBER_LIST@19..19 5: R_CURLY@19..20 "}" [] [] 5: (empty) 4: EOF@20..21 "" [Newline("\n")] [] -- class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Classes can only be declared at top level or inside a block > 1 │ if (true) class A {} │ ^^^^^^^^^^ 2 │ i wrap the class in a block statement -- if (true) class A {}