From d1dc465dcdf7b18ea1a77ede7858d2eaf1fa0e16 Mon Sep 17 00:00:00 2001 From: Daiki Nishikawa Date: Wed, 8 Mar 2023 09:16:29 +0900 Subject: [PATCH] feat(rome_js_parser): Support optional variance annotation (#4250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 init * fix: 🐛 parse error * test: 💍 update more test case * test: 💍 update test case * test: 💍 update error test case * test: 💍 update test case * style: 💄 clippy and fmt * test: 💍 add extra test case * chore: 🤖 conflict resolve * test: 💍 update snapshot * chore: 🤖 update test result * test: 💍 update snapshot * chore: 🤖 update test parser * style: 💄 fmt * test: 💍 update format test snapshot * feat: update parse logic * feat: separate parse_ts_type_parameters and parse_ts_type_parameters_with_modifiers * fix: update test case * feat: update parser * fix: update tests * feat: refactor allow_in_out_modifier arguments * feat: revert unnecessary diff --------- Co-authored-by: IWANABETHATGUY --- .../src/generated/node_factory.rs | 16 + .../src/generated/syntax_factory.rs | 16 +- crates/rome_js_formatter/src/format.rs | 1424 +++++++++ .../src/ts/bindings/type_parameter.rs | 10 +- .../optional-variance/basic.ts.snap | 796 ----- crates/rome_js_parser/src/lexer/mod.rs | 1 + crates/rome_js_parser/src/syntax/class.rs | 2 +- .../src/syntax/typescript/statement.rs | 4 +- .../src/syntax/typescript/types.rs | 196 +- .../err/ts_constructor_type_parameters.rast | 10 +- .../err/ts_declare_function_with_body.rast | 10 +- .../err/ts_getter_setter_type_parameters.rast | 20 +- .../err/ts_instantiation_expressions_1.rast | 40 +- .../err/ts_object_getter_type_parameters.rast | 10 +- .../err/ts_object_setter_type_parameters.rast | 10 +- .../err/ts_type_parameters_incomplete.rast | 10 +- .../inline/err/type_parameter_modifier.rast | 980 ++++++ .../inline/err/type_parameter_modifier.ts | 11 + .../inline/err/type_parameter_modifier1.rast | 2785 +++++++++++++++++ .../inline/err/type_parameter_modifier1.ts | 28 + .../ok/ts_arrow_function_type_parameters.rast | 50 +- .../test_data/inline/ok/ts_as_assignment.rast | 10 +- .../ok/ts_call_expr_with_type_arguments.rast | 50 +- .../inline/ok/ts_call_signature_member.rast | 20 +- .../inline/ok/ts_class_type_parameters.rast | 30 +- .../inline/ok/ts_conditional_type.rast | 60 +- ...s_conditional_type_call_signature_lhs.rast | 10 +- .../ok/ts_construct_signature_member.rast | 20 +- .../inline/ok/ts_constructor_type.rast | 40 +- .../inline/ok/ts_declare_function.rast | 30 +- .../inline/ok/ts_default_type_clause.rast | 20 +- .../inline/ok/ts_function_statement.rast | 30 +- .../test_data/inline/ok/ts_function_type.rast | 20 +- .../ok/ts_instantiation_expressions.rast | 20 +- .../ok/ts_interface_extends_clause.rast | 10 +- .../test_data/inline/ok/ts_mapped_type.rast | 40 +- .../inline/ok/ts_method_class_member.rast | 30 +- .../ok/ts_method_object_member_body.rast | 20 +- .../inline/ok/ts_new_with_type_arguments.rast | 30 +- .../inline/ok/ts_optional_chain_call.rast | 20 +- ...s_property_or_method_signature_member.rast | 20 +- .../inline/ok/ts_satisfies_assignment.rast | 10 +- .../inline/ok/ts_template_literal_type.rast | 10 +- .../ok/ts_type_arguments_left_shift.rast | 20 +- .../inline/ok/ts_type_constraint_clause.rast | 20 +- .../inline/ok/ts_type_parameters.rast | 30 +- .../test_data/inline/ok/ts_typeof_type.rast | 10 +- .../inline/ok/tsx_type_arguments.rast | 50 +- .../inline/ok/type_parameter_modifier.rast | 1022 ++++++ .../inline/ok/type_parameter_modifier.ts | 19 + .../ok/type_parameter_modifier_tsx.rast | 496 +++ .../inline/ok/type_parameter_modifier_tsx.tsx | 7 + crates/rome_js_syntax/src/generated/kind.rs | 6 +- crates/rome_js_syntax/src/generated/nodes.rs | 20 +- .../rome_js_syntax/src/generated/nodes_mut.rs | 18 +- crates/rome_js_syntax/src/lib.rs | 4 +- xtask/codegen/js.ungram | 2 + xtask/codegen/src/kinds_src.rs | 2 + 58 files changed, 7635 insertions(+), 1070 deletions(-) create mode 100644 crates/rome_js_formatter/src/format.rs delete mode 100644 crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap create mode 100644 crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast create mode 100644 crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.ts create mode 100644 crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.rast create mode 100644 crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.ts create mode 100644 crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast create mode 100644 crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.ts create mode 100644 crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast create mode 100644 crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx diff --git a/crates/rome_js_factory/src/generated/node_factory.rs b/crates/rome_js_factory/src/generated/node_factory.rs index a5193314b25..73fc5d577fb 100644 --- a/crates/rome_js_factory/src/generated/node_factory.rs +++ b/crates/rome_js_factory/src/generated/node_factory.rs @@ -6229,16 +6229,28 @@ pub fn ts_type_operator_type( pub fn ts_type_parameter(name: TsTypeParameterName) -> TsTypeParameterBuilder { TsTypeParameterBuilder { name, + in_modifier_token: None, + out_modifier_token: None, constraint: None, default: None, } } pub struct TsTypeParameterBuilder { name: TsTypeParameterName, + in_modifier_token: Option, + out_modifier_token: Option, constraint: Option, default: Option, } impl TsTypeParameterBuilder { + pub fn with_in_modifier_token(mut self, in_modifier_token: SyntaxToken) -> Self { + self.in_modifier_token = Some(in_modifier_token); + self + } + pub fn with_out_modifier_token(mut self, out_modifier_token: SyntaxToken) -> Self { + self.out_modifier_token = Some(out_modifier_token); + self + } pub fn with_constraint(mut self, constraint: TsTypeConstraintClause) -> Self { self.constraint = Some(constraint); self @@ -6251,6 +6263,10 @@ impl TsTypeParameterBuilder { TsTypeParameter::unwrap_cast(SyntaxNode::new_detached( JsSyntaxKind::TS_TYPE_PARAMETER, [ + self.in_modifier_token + .map(|token| SyntaxElement::Token(token)), + self.out_modifier_token + .map(|token| SyntaxElement::Token(token)), Some(SyntaxElement::Node(self.name.into_syntax())), self.constraint .map(|token| SyntaxElement::Node(token.into_syntax())), diff --git a/crates/rome_js_factory/src/generated/syntax_factory.rs b/crates/rome_js_factory/src/generated/syntax_factory.rs index 8d70ec5d3b0..e0fb779237a 100644 --- a/crates/rome_js_factory/src/generated/syntax_factory.rs +++ b/crates/rome_js_factory/src/generated/syntax_factory.rs @@ -9478,8 +9478,22 @@ impl SyntaxFactory for JsSyntaxFactory { } TS_TYPE_PARAMETER => { let mut elements = (&children).into_iter(); - let mut slots: RawNodeSlots<3usize> = RawNodeSlots::default(); + let mut slots: RawNodeSlots<5usize> = RawNodeSlots::default(); let mut current_element = elements.next(); + if let Some(element) = ¤t_element { + if element.kind() == T![in] { + slots.mark_present(); + current_element = elements.next(); + } + } + slots.next_slot(); + if let Some(element) = ¤t_element { + if element.kind() == T![out] { + slots.mark_present(); + current_element = elements.next(); + } + } + slots.next_slot(); if let Some(element) = ¤t_element { if TsTypeParameterName::can_cast(element.kind()) { slots.mark_present(); diff --git a/crates/rome_js_formatter/src/format.rs b/crates/rome_js_formatter/src/format.rs new file mode 100644 index 00000000000..bb4d590c07a --- /dev/null +++ b/crates/rome_js_formatter/src/format.rs @@ -0,0 +1,1424 @@ +//! Generated file, do not edit by hand, see `xtask/codegen` + +use crate::{Format, FormatElement, FormatNode, Formatter}; +use rome_formatter::FormatResult; +impl Format for rome_js_syntax::JsScript { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsModule { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExpressionSnipped { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsDirective { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBlockStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBreakStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsClassDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsContinueStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsDebuggerStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsDoWhileStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsEmptyStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExpressionStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsForInStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsForOfStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsForStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsIfStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsLabeledStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsReturnStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSwitchStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsThrowStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsTryFinallyStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsTryStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsVariableStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsWhileStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsWithStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFunctionDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsEnumDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeAliasDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsInterfaceDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDeclareFunctionDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDeclareStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsModuleDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExternalModuleDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsGlobalDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsImportEqualsDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsElseClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsVariableDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsForVariableDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsVariableDeclarator { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsCaseClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsDefaultClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsCatchClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFinallyClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsCatchDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeAnnotation { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::ImportMeta { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrowFunctionExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsAssignmentExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsAwaitExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBinaryExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsCallExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsClassExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsComputedMemberExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsConditionalExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFunctionExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsIdentifierExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportCallExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsInExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsInstanceofExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsLogicalExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNewExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsParenthesizedExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPostUpdateExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPreUpdateExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSequenceExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsStaticMemberExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSuperExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsThisExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnaryExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsYieldExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::NewTarget { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsTemplate { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeAssertionExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAsExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNonNullAssertionExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxTagExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeArguments { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsTemplateChunkElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsTemplateElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsCallArguments { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsYieldArgument { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeParameters { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsParameters { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsReturnTypeAnnotation { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFunctionBody { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSpread { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayHole { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsReferenceIdentifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPrivateName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsLiteralMemberName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsComputedMemberName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPropertyObjectMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsMethodObjectMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsGetterObjectMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSetterObjectMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsShorthandPropertyObjectMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExtendsClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsImplementsClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsClassExportDefaultDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPrivateClassMemberName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsConstructorClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsStaticInitializationBlockClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsPropertyClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsMethodClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsGetterClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsSetterClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsConstructorSignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsPropertySignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMethodSignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsGetterSignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsSetterSignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIndexSignatureClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsEmptyClassMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsStaticModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDeclareModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsReadonlyModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAbstractModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsOverrideModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAccessibilityModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsConstructorParameters { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsRestParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsPropertyParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsInitializerClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsOptionalPropertyAnnotation { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDefinitePropertyAnnotation { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIndexSignatureParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsIdentifierAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsStaticMemberAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsComputedMemberAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsParenthesizedAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNonNullAssertionAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAsAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeAssertionAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsAssignmentWithDefault { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayAssignmentPattern { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectAssignmentPattern { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayAssignmentPatternRestElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectAssignmentPatternShorthandProperty { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectAssignmentPatternProperty { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectAssignmentPatternRest { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsIdentifierBinding { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBindingPatternWithDefault { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayBindingPattern { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectBindingPattern { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsArrayBindingPatternRestElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectBindingPatternProperty { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectBindingPatternRest { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsObjectBindingPatternShorthandProperty { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsStringLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNumberLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBigIntLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsBooleanLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNullLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsRegexLiteralExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsVariableDeclarationClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDefiniteVariableAnnotation { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExport { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImport { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportBareClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportNamedClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportDefaultClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportNamespaceClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsModuleSource { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportAssertion { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsDefaultImportSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNamedImportSpecifiers { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNamespaceImportSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsShorthandNamedImportSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsNamedImportSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsLiteralExportName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsImportAssertionEntry { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportDefaultDeclarationClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportDefaultExpressionClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportNamedClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportFromClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportNamedFromClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExportAsNamespaceClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExportAssignmentClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExportDeclareClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFunctionExportDefaultDeclaration { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportNamedShorthandSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportNamedSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportAsClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsExportNamedFromSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsFormalParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsThisParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAnyType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsUnknownType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNumberType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsBooleanType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsBigintType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsStringType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsSymbolType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsVoidType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsUndefinedType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNeverType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsParenthesizedType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsReferenceType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsArrayType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTupleType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeofType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsImportType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeOperatorType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIndexedAccessType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMappedType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsObjectType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNonPrimitiveType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsThisType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNumberLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsBigIntLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsStringLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNullLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsBooleanLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTemplateLiteralType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsInferType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIntersectionType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsUnionType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsFunctionType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsConstructorType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsConditionalType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIdentifierBinding { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsEnumMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExternalModuleReference { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsModuleBlock { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsQualifiedModuleName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsEmptyExternalModuleDeclarationBody { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeParameterName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeParameterModifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsPredicateReturnType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAssertsReturnType { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsAssertsCondition { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTypeConstraintClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsDefaultTypeClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsExtendsClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNameWithTypeArguments { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsCallSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsPropertySignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsConstructSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMethodSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsGetterSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsSetterSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsIndexSignatureTypeMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMappedTypeReadonlyModifierClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMappedTypeAsClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsMappedTypeOptionalModifierClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsImportTypeQualifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsNamedTupleTypeElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsRestTupleTypeElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsOptionalTupleTypeElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTemplateChunkElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsTemplateElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::TsQualifiedName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxSelfClosingElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxFragment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxOpeningElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxClosingElement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxOpeningFragment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxClosingFragment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxReferenceIdentifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxNamespaceName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxMemberName { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxAttribute { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxSpreadAttribute { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxAttributeInitializerClause { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxString { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxExpressionAttributeValue { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxText { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxExpressionChild { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsxSpreadChild { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknown { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownStatement { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownExpression { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownMember { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownBinding { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownAssignment { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownParameter { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownImportAssertionEntry { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} +impl Format for rome_js_syntax::JsUnknownNamedImportSpecifier { + fn format(&self, formatter: &Formatter) -> FormatResult { + self.format_node(formatter) + } +} diff --git a/crates/rome_js_formatter/src/ts/bindings/type_parameter.rs b/crates/rome_js_formatter/src/ts/bindings/type_parameter.rs index b541462a33a..82761c79383 100644 --- a/crates/rome_js_formatter/src/ts/bindings/type_parameter.rs +++ b/crates/rome_js_formatter/src/ts/bindings/type_parameter.rs @@ -12,10 +12,18 @@ impl FormatNodeRule for FormatTsTypeParameter { name, constraint, default, + in_modifier_token, + out_modifier_token, } = node.as_fields(); - write!(f, [name.format()])?; + if let Some(in_modifier_token) = in_modifier_token { + write!(f, [in_modifier_token.format(), space()])?; + } + if let Some(out_modifier_token) = out_modifier_token { + write!(f, [out_modifier_token.format(), space()])?; + } + write!(f, [name.format()])?; if let Some(constraint) = constraint { write!(f, [space(), constraint.format()])?; } diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap deleted file mode 100644 index 8d323986d2f..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap +++ /dev/null @@ -1,796 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/optional-variance/basic.ts ---- - -# Input - -```ts -type Covariant = { - x: T; -} -type Contravariant = { - f: (x: T) => void; -} -type Invariant = { - f: (x: T) => T; -} -type T10 = T; -type T11 = keyof T; -type T12 = T[K]; -type T13 = T[keyof T]; - -type Covariant1 = { - x: T; -} - -type Contravariant1 = keyof T; - -type Contravariant2 = { - f: (x: T) => void; -} - -type Invariant1 = { - f: (x: T) => T; -} - -type Invariant2 = { - f: (x: T) => T; -} -type Foo1 = { - x: T; - f: FooFn1; -} - -type Foo2 = { - x: T; - f: FooFn2; -} - -type Foo3 = { - x: T; - f: FooFn3; -} - -type T21 = T; - -interface Baz {} -interface Baz {} - -interface Parent { - child: Child | null; - parent: Parent | null; -} - -declare class StateNode { - _storedEvent: TEvent; - _action: ActionObject; - _state: StateNode; -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,48 +1,48 @@ - type Covariant = { -- x: T; --}; -+ x: T; -+} - type Contravariant = { -- f: (x: T) => void; --}; -+ f: (x: T) => void; -+} - type Invariant = { -- f: (x: T) => T; --}; -+ f: (x: T) => T; -+} - type T10 = T; - type T11 = keyof T; - type T12 = T[K]; - type T13 = T[keyof T]; - - type Covariant1 = { -- x: T; --}; -+ x: T; -+} - - type Contravariant1 = keyof T; - - type Contravariant2 = { -- f: (x: T) => void; --}; -+ f: (x: T) => void; -+} - - type Invariant1 = { -- f: (x: T) => T; --}; -+ f: (x: T) => T; -+} - - type Invariant2 = { -- f: (x: T) => T; --}; -+ f: (x: T) => T; -+} - type Foo1 = { -- x: T; -- f: FooFn1; --}; -+ x: T; -+ f: FooFn1; -+} - - type Foo2 = { -- x: T; -- f: FooFn2; --}; -+ x: T; -+ f: FooFn2; -+} - - type Foo3 = { -- x: T; -- f: FooFn3; --}; -+ x: T; -+ f: FooFn3; -+} - - type T21 = T; - -@@ -50,12 +50,12 @@ - interface Baz {} - - interface Parent { -- child: Child | null; -- parent: Parent | null; -+ child: Child | null; -+ parent: Parent | null; - } - - declare class StateNode { -- _storedEvent: TEvent; -- _action: ActionObject; -- _state: StateNode; -+ _storedEvent: TEvent; -+ _action: ActionObject; -+ _state: StateNode; - } -``` - -# Output - -```ts -type Covariant = { - x: T; -} -type Contravariant = { - f: (x: T) => void; -} -type Invariant = { - f: (x: T) => T; -} -type T10 = T; -type T11 = keyof T; -type T12 = T[K]; -type T13 = T[keyof T]; - -type Covariant1 = { - x: T; -} - -type Contravariant1 = keyof T; - -type Contravariant2 = { - f: (x: T) => void; -} - -type Invariant1 = { - f: (x: T) => T; -} - -type Invariant2 = { - f: (x: T) => T; -} -type Foo1 = { - x: T; - f: FooFn1; -} - -type Foo2 = { - x: T; - f: FooFn2; -} - -type Foo3 = { - x: T; - f: FooFn3; -} - -type T21 = T; - -interface Baz {} -interface Baz {} - -interface Parent { - child: Child | null; - parent: Parent | null; -} - -declare class StateNode { - _storedEvent: TEvent; - _action: ActionObject; - _state: StateNode; -} -``` - -# Errors -``` -basic.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - > 1 │ type Covariant = { - │ ^ - 2 │ x: T; - 3 │ } - - i Remove T - -basic.ts:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 2 │ x: T; - 3 │ } - > 4 │ type Contravariant = { - │ ^^ - 5 │ f: (x: T) => void; - 6 │ } - - i Expected a type parameter here - - 2 │ x: T; - 3 │ } - > 4 │ type Contravariant = { - │ ^^ - 5 │ f: (x: T) => void; - 6 │ } - -basic.ts:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 2 │ x: T; - 3 │ } - > 4 │ type Contravariant = { - │ ^ - 5 │ f: (x: T) => void; - 6 │ } - - i Remove T - -basic.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 5 │ f: (x: T) => void; - 6 │ } - > 7 │ type Invariant = { - │ ^^ - 8 │ f: (x: T) => T; - 9 │ } - - i Expected a type parameter here - - 5 │ f: (x: T) => void; - 6 │ } - > 7 │ type Invariant = { - │ ^^ - 8 │ f: (x: T) => T; - 9 │ } - -basic.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `out` - - 5 │ f: (x: T) => void; - 6 │ } - > 7 │ type Invariant = { - │ ^^^ - 8 │ f: (x: T) => T; - 9 │ } - - i Remove out - -basic.ts:7:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 5 │ f: (x: T) => void; - 6 │ } - > 7 │ type Invariant = { - │ ^ - 8 │ f: (x: T) => T; - 9 │ } - - i Remove T - -basic.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 8 │ f: (x: T) => T; - 9 │ } - > 10 │ type T10 = T; - │ ^ - 11 │ type T11 = keyof T; - 12 │ type T12 = T[K]; - - i Remove T - -basic.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 9 │ } - 10 │ type T10 = T; - > 11 │ type T11 = keyof T; - │ ^^ - 12 │ type T12 = T[K]; - 13 │ type T13 = T[keyof T]; - - i Expected a type parameter here - - 9 │ } - 10 │ type T10 = T; - > 11 │ type T11 = keyof T; - │ ^^ - 12 │ type T12 = T[K]; - 13 │ type T13 = T[keyof T]; - -basic.ts:11:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 9 │ } - 10 │ type T10 = T; - > 11 │ type T11 = keyof T; - │ ^ - 12 │ type T12 = T[K]; - 13 │ type T13 = T[keyof T]; - - i Remove T - -basic.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 10 │ type T10 = T; - 11 │ type T11 = keyof T; - > 12 │ type T12 = T[K]; - │ ^ - 13 │ type T13 = T[keyof T]; - 14 │ - - i Remove T - -basic.ts:12:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `K` - - 10 │ type T10 = T; - 11 │ type T11 = keyof T; - > 12 │ type T12 = T[K]; - │ ^ - 13 │ type T13 = T[keyof T]; - 14 │ - - i Remove K - -basic.ts:13:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 11 │ type T11 = keyof T; - 12 │ type T12 = T[K]; - > 13 │ type T13 = T[keyof T]; - │ ^^ - 14 │ - 15 │ type Covariant1 = { - - i Expected a type parameter here - - 11 │ type T11 = keyof T; - 12 │ type T12 = T[K]; - > 13 │ type T13 = T[keyof T]; - │ ^^ - 14 │ - 15 │ type Covariant1 = { - -basic.ts:13:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `out` - - 11 │ type T11 = keyof T; - 12 │ type T12 = T[K]; - > 13 │ type T13 = T[keyof T]; - │ ^^^ - 14 │ - 15 │ type Covariant1 = { - - i Remove out - -basic.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 11 │ type T11 = keyof T; - 12 │ type T12 = T[K]; - > 13 │ type T13 = T[keyof T]; - │ ^ - 14 │ - 15 │ type Covariant1 = { - - i Remove T - -basic.ts:15:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 13 │ type T13 = T[keyof T]; - 14 │ - > 15 │ type Covariant1 = { - │ ^^ - 16 │ x: T; - 17 │ } - - i Expected a type parameter here - - 13 │ type T13 = T[keyof T]; - 14 │ - > 15 │ type Covariant1 = { - │ ^^ - 16 │ x: T; - 17 │ } - -basic.ts:15:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 13 │ type T13 = T[keyof T]; - 14 │ - > 15 │ type Covariant1 = { - │ ^ - 16 │ x: T; - 17 │ } - - i Remove T - -basic.ts:19:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 17 │ } - 18 │ - > 19 │ type Contravariant1 = keyof T; - │ ^ - 20 │ - 21 │ type Contravariant2 = { - - i Remove T - -basic.ts:21:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 19 │ type Contravariant1 = keyof T; - 20 │ - > 21 │ type Contravariant2 = { - │ ^ - 22 │ f: (x: T) => void; - 23 │ } - - i Remove T - -basic.ts:25:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 23 │ } - 24 │ - > 25 │ type Invariant1 = { - │ ^^ - 26 │ f: (x: T) => T; - 27 │ } - - i Expected a type parameter here - - 23 │ } - 24 │ - > 25 │ type Invariant1 = { - │ ^^ - 26 │ f: (x: T) => T; - 27 │ } - -basic.ts:25:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 23 │ } - 24 │ - > 25 │ type Invariant1 = { - │ ^ - 26 │ f: (x: T) => T; - 27 │ } - - i Remove T - -basic.ts:29:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 27 │ } - 28 │ - > 29 │ type Invariant2 = { - │ ^ - 30 │ f: (x: T) => T; - 31 │ } - - i Remove T - -basic.ts:32:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 30 │ f: (x: T) => T; - 31 │ } - > 32 │ type Foo1 = { - │ ^^ - 33 │ x: T; - 34 │ f: FooFn1; - - i Expected a type parameter here - - 30 │ f: (x: T) => T; - 31 │ } - > 32 │ type Foo1 = { - │ ^^ - 33 │ x: T; - 34 │ f: FooFn1; - -basic.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 30 │ f: (x: T) => T; - 31 │ } - > 32 │ type Foo1 = { - │ ^ - 33 │ x: T; - 34 │ f: FooFn1; - - i Remove T - -basic.ts:37:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 35 │ } - 36 │ - > 37 │ type Foo2 = { - │ ^ - 38 │ x: T; - 39 │ f: FooFn2; - - i Remove T - -basic.ts:42:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 40 │ } - 41 │ - > 42 │ type Foo3 = { - │ ^^ - 43 │ x: T; - 44 │ f: FooFn3; - - i Expected a type parameter here - - 40 │ } - 41 │ - > 42 │ type Foo3 = { - │ ^^ - 43 │ x: T; - 44 │ f: FooFn3; - -basic.ts:42:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `out` - - 40 │ } - 41 │ - > 42 │ type Foo3 = { - │ ^^^ - 43 │ x: T; - 44 │ f: FooFn3; - - i Remove out - -basic.ts:42:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 40 │ } - 41 │ - > 42 │ type Foo3 = { - │ ^ - 43 │ x: T; - 44 │ f: FooFn3; - - i Remove T - -basic.ts:47:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 45 │ } - 46 │ - > 47 │ type T21 = T; - │ ^^ - 48 │ - 49 │ interface Baz {} - - i Expected a type parameter here - - 45 │ } - 46 │ - > 47 │ type T21 = T; - │ ^^ - 48 │ - 49 │ interface Baz {} - -basic.ts:47:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `out` - - 45 │ } - 46 │ - > 47 │ type T21 = T; - │ ^^^ - 48 │ - 49 │ interface Baz {} - - i Remove out - -basic.ts:47:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 45 │ } - 46 │ - > 47 │ type T21 = T; - │ ^ - 48 │ - 49 │ interface Baz {} - - i Remove T - -basic.ts:49:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 47 │ type T21 = T; - 48 │ - > 49 │ interface Baz {} - │ ^ - 50 │ interface Baz {} - 51 │ - - i Remove T - -basic.ts:50:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 49 │ interface Baz {} - > 50 │ interface Baz {} - │ ^^ - 51 │ - 52 │ interface Parent { - - i Expected a type parameter here - - 49 │ interface Baz {} - > 50 │ interface Baz {} - │ ^^ - 51 │ - 52 │ interface Parent { - -basic.ts:50:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `T` - - 49 │ interface Baz {} - > 50 │ interface Baz {} - │ ^ - 51 │ - 52 │ interface Parent { - - i Remove T - -basic.ts:52:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `A` - - 50 │ interface Baz {} - 51 │ - > 52 │ interface Parent { - │ ^ - 53 │ child: Child | null; - 54 │ parent: Parent | null; - - i Remove A - -basic.ts:57:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected a type parameter but instead found 'in' - - 55 │ } - 56 │ - > 57 │ declare class StateNode { - │ ^^ - 58 │ _storedEvent: TEvent; - 59 │ _action: ActionObject; - - i Expected a type parameter here - - 55 │ } - 56 │ - > 57 │ declare class StateNode { - │ ^^ - 58 │ _storedEvent: TEvent; - 59 │ _action: ActionObject; - -basic.ts:57:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `out` - - 55 │ } - 56 │ - > 57 │ declare class StateNode { - │ ^^^ - 58 │ _storedEvent: TEvent; - 59 │ _action: ActionObject; - - i Remove out - -basic.ts:57:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `,` but instead found `TEvent` - - 55 │ } - 56 │ - > 57 │ declare class StateNode { - │ ^^^^^^ - 58 │ _storedEvent: TEvent; - 59 │ _action: ActionObject; - - i Remove TEvent - - -``` - - diff --git a/crates/rome_js_parser/src/lexer/mod.rs b/crates/rome_js_parser/src/lexer/mod.rs index 421b70cfcaa..ddd48030a9b 100644 --- a/crates/rome_js_parser/src/lexer/mod.rs +++ b/crates/rome_js_parser/src/lexer/mod.rs @@ -1091,6 +1091,7 @@ impl<'src> Lexer<'src> { b"bigint" => BIGINT_KW, b"override" => OVERRIDE_KW, b"of" => OF_KW, + b"out" => OUT_KW, _ => T![ident], } } diff --git a/crates/rome_js_parser/src/syntax/class.rs b/crates/rome_js_parser/src/syntax/class.rs index 9c3d8b3fac6..f13c459d45c 100644 --- a/crates/rome_js_parser/src/syntax/class.rs +++ b/crates/rome_js_parser/src/syntax/class.rs @@ -255,7 +255,7 @@ fn parse_class(p: &mut JsParser, kind: ClassKind) -> CompletedMarker { TypeScript .parse_exclusive_syntax( p, - |p| parse_ts_type_parameters(p, TypeContext::default()), + |p| parse_ts_type_parameters(p, TypeContext::default().and_allow_in_out_modifier(true)), |p, type_parameters| { ts_only_syntax_error(p, "class type parameters", type_parameters.range(p)) }, diff --git a/crates/rome_js_parser/src/syntax/typescript/statement.rs b/crates/rome_js_parser/src/syntax/typescript/statement.rs index 7cef4c591ab..98867023e68 100644 --- a/crates/rome_js_parser/src/syntax/typescript/statement.rs +++ b/crates/rome_js_parser/src/syntax/typescript/statement.rs @@ -207,7 +207,7 @@ pub(crate) fn parse_ts_type_alias_declaration(p: &mut JsParser) -> ParsedSyntax p.expect(T![type]); parse_ts_identifier_binding(p, super::TsIdentifierContext::Type) .or_add_diagnostic(p, expected_identifier); - parse_ts_type_parameters(p, TypeContext::default()).ok(); + parse_ts_type_parameters(p, TypeContext::default().and_allow_in_out_modifier(true)).ok(); p.expect(T![=]); parse_ts_type(p, TypeContext::default()).or_add_diagnostic(p, expected_ts_type); @@ -298,7 +298,7 @@ pub(crate) fn parse_ts_interface_declaration(p: &mut JsParser) -> ParsedSyntax { p.expect(T![interface]); parse_ts_identifier_binding(p, super::TsIdentifierContext::Type) .or_add_diagnostic(p, expected_identifier); - parse_ts_type_parameters(p, TypeContext::default()).ok(); + parse_ts_type_parameters(p, TypeContext::default().and_allow_in_out_modifier(true)).ok(); eat_interface_heritage_clause(p); p.expect(T!['{']); TypeMembers.parse_list(p); diff --git a/crates/rome_js_parser/src/syntax/typescript/types.rs b/crates/rome_js_parser/src/syntax/typescript/types.rs index b51ea0d7c93..4a833cb596d 100644 --- a/crates/rome_js_parser/src/syntax/typescript/types.rs +++ b/crates/rome_js_parser/src/syntax/typescript/types.rs @@ -12,7 +12,7 @@ use crate::syntax::function::{ }; use crate::syntax::js_parse_error::{ expected_identifier, expected_object_member_name, expected_parameter, expected_parameters, - expected_property_or_signature, + expected_property_or_signature, modifier_already_seen, modifier_must_precede_modifier, }; use crate::syntax::object::{ is_at_object_member_name, is_nth_at_type_member_name, parse_object_member_name, @@ -22,6 +22,7 @@ use crate::syntax::typescript::try_parse; use crate::syntax::typescript::ts_parse_error::{expected_ts_type, expected_ts_type_parameter}; use bitflags::bitflags; use rome_parser::parse_lists::{ParseNodeList, ParseSeparatedList}; +use smallvec::SmallVec; use crate::lexer::{LexContext, ReLexContext}; use crate::span::Span; @@ -41,6 +42,11 @@ bitflags! { /// /// By default, conditional types are allowed. const DISALLOW_CONDITIONAL_TYPES = 1 << 0; + + /// Whether 'in' and 'out' modifiers are allowed in the current context. + /// + /// By default, 'in' and 'out' modifiers are not allowed. + const ALLOW_IN_OUT_MODIFIER = 1 << 1; } } @@ -49,10 +55,18 @@ impl TypeContext { self.and(TypeContext::DISALLOW_CONDITIONAL_TYPES, !allow) } + pub(crate) fn and_allow_in_out_modifier(self, allow: bool) -> Self { + self.and(TypeContext::ALLOW_IN_OUT_MODIFIER, allow) + } + pub(crate) const fn is_conditional_type_allowed(&self) -> bool { !self.contains(TypeContext::DISALLOW_CONDITIONAL_TYPES) } + pub(crate) const fn is_in_out_modifier_allowed(&self) -> bool { + self.contains(TypeContext::ALLOW_IN_OUT_MODIFIER) + } + /// Adds the `flag` if `set` is `true`, otherwise removes the `flag` fn and(self, flag: TypeContext, set: bool) -> Self { if set { @@ -183,13 +197,179 @@ impl ParseSeparatedList for TsTypeParameterList { } } +// test_err ts type_parameter_modifier1 +// export default function foo() {} +// export function foo() {} +// export function foo1() {} +// export function foo2() {} +// let foo: Foo +// let foo: Foo +// declare function foo() +// declare function foo() +// declare let foo: Foo +// declare let foo: Foo +// foo = function () {} +// foo = function () {} +// class Foo { foo(): T {} } +// class Foo { foo(): T {} } +// foo = { foo(): T {} }; +// foo = { foo(): T {} }; +// () => {}; +// () => {}; +// () => {}; +// let x: () => {}; +// let x: () => {}; +// let x: () => {}; +// let x: new () => {}; +// let x: new () => {}; +// let x: new () => {}; +// let x: { y(): any }; +// let x: { y(): any }; +// let x: { y(): any }; + +// test_err ts type_parameter_modifier +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// function foo() {} +// function foo() {} + +// test tsx type_parameter_modifier_tsx +// ; +// ; +// ; +// ; +// ; +// ; +// ; + +// test ts type_parameter_modifier +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// type Foo = {} +// class Foo {} +// class Foo {} +// export default class Foo {} +// class Foo {} +// interface Foo {} +// interface Foo {} +// declare class Foo {} +// declare class Foo {} +// declare interface Foo {} +// declare interface Foo {} + fn parse_ts_type_parameter(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { - parse_ts_type_parameter_name(p).map(|name| { - let m = name.precede(p); - parse_ts_type_constraint_clause(p, context).ok(); - parse_ts_default_type_clause(p).ok(); - m.complete(p, TS_TYPE_PARAMETER) - }) + let m = p.start(); + parse_ts_type_parameter_modifiers(p, context); + + let name = parse_ts_type_parameter_name(p); + parse_ts_type_constraint_clause(p, context).ok(); + parse_ts_default_type_clause(p).ok(); + + if name.is_absent() { + m.abandon(p); + Absent + } else { + Present(m.complete(p, TS_TYPE_PARAMETER)) + } +} + +#[derive(Eq, PartialEq, Clone, Copy, Debug)] +enum TypeParameterModifierKind { + In, + Out, +} + +/// Stores the range of a parsed modifier with its kind +#[derive(Eq, PartialEq, Clone, Copy, Debug)] +struct TypeParameterModifier { + kind: TypeParameterModifierKind, + range: TextRange, +} + +#[derive(Debug, Default)] +struct ClassMemberModifierList(SmallVec<[TypeParameterModifier; 2]>); + +impl ClassMemberModifierList { + /// Sets the range of a parsed modifier + fn add_modifier(&mut self, modifier: TypeParameterModifier) { + self.0.push(modifier); + } + + fn find(&self, modifier_kind: &TypeParameterModifierKind) -> Option<&TypeParameterModifier> { + self.0 + .iter() + .find(|predicate| predicate.kind == *modifier_kind) + } +} + +fn parse_ts_type_parameter_modifiers(p: &mut JsParser, context: TypeContext) { + let mut modifiers = ClassMemberModifierList::default(); + while p.at_ts(token_set!(T![in], T![out])) && !p.nth_at(1, T![,]) && !p.nth_at(1, T![>]) { + if !context.is_in_out_modifier_allowed() { + let text_range = p.cur_range(); + p.error(p.err_builder( + format!( + "'{}' modifier can only appear on a type parameter of a class, interface or type alias.", + p.text(text_range) + ), + text_range, + )); + p.bump_any(); + continue; + } + + let modifier = match p.cur() { + T![in] => TypeParameterModifier { + kind: TypeParameterModifierKind::In, + range: p.cur_range(), + }, + T![out] => TypeParameterModifier { + kind: TypeParameterModifierKind::Out, + range: p.cur_range(), + }, + _ => unreachable!("keywords that are not 'in' and 'out' are checked earlier"), + }; + + // check for duplicate modifiers + if let Some(existing_modifier) = modifiers.find(&modifier.kind) { + p.error(modifier_already_seen( + p, + modifier.range, + existing_modifier.range, + )); + p.bump_any(); + continue; + } + + // check for modifier precedence + if let Some(out_modifier) = modifiers.find(&TypeParameterModifierKind::Out) { + if modifier.kind == TypeParameterModifierKind::In { + p.error(modifier_must_precede_modifier( + p, + modifier.range, + out_modifier.range, + )); + p.bump_any(); + continue; + } + } + + modifiers.add_modifier(modifier); + p.bump_any(); + } } // test ts ts_type_constraint_clause @@ -903,7 +1083,7 @@ fn parse_ts_construct_signature_type_member( let m = p.start(); p.expect(T![new]); - parse_ts_type_parameters(p, context).ok(); + parse_ts_type_parameters(p, context.and_allow_in_out_modifier(true)).ok(); parse_parameter_list(p, ParameterContext::Declaration, SignatureFlags::empty()) .or_add_diagnostic(p, expected_parameters); parse_ts_type_annotation(p).ok(); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast index 7a3dfbfa7f2..cc7eec6816a 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast @@ -23,6 +23,8 @@ JsModule { l_angle_token: L_ANGLE@21..22 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@22..23 "A" [] [], }, @@ -83,10 +85,12 @@ JsModule { 0: L_ANGLE@21..22 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@22..23 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@23..24 ">" [] [] 3: JS_CONSTRUCTOR_PARAMETERS@24..28 0: L_PAREN@24..25 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast b/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast index 605be3eff33..516b1296271 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast @@ -15,6 +15,8 @@ JsModule { l_angle_token: L_ANGLE@21..22 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@22..23 "A" [] [], }, @@ -88,10 +90,12 @@ JsModule { 0: L_ANGLE@21..22 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@22..23 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@23..24 ">" [] [] 3: JS_PARAMETERS@24..30 0: L_PAREN@24..25 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast index 90937b53850..b05de8d38de 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast @@ -24,6 +24,8 @@ JsModule { l_angle_token: L_ANGLE@19..20 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@20..21 "A" [] [], }, @@ -63,6 +65,8 @@ JsModule { l_angle_token: L_ANGLE@37..38 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@38..39 "A" [] [], }, @@ -128,10 +132,12 @@ JsModule { 0: L_ANGLE@19..20 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@20..21 0: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@21..22 ">" [] [] 4: L_PAREN@22..23 "(" [] [] 5: R_PAREN@23..24 ")" [] [] @@ -155,10 +161,12 @@ JsModule { 0: L_ANGLE@37..38 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@38..39 0: TS_TYPE_PARAMETER@38..39 - 0: TS_TYPE_PARAMETER_NAME@38..39 - 0: IDENT@38..39 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@38..39 + 0: IDENT@38..39 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@39..40 ">" [] [] 4: L_PAREN@40..41 "(" [] [] 5: JS_FORMAL_PARAMETER@41..49 diff --git a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast index 4d882ea13ab..fa103f4c2c2 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast @@ -107,6 +107,8 @@ JsModule { l_angle_token: L_ANGLE@114..116 "<" [] [Whitespace(" ")], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@116..117 "f" [] [], }, @@ -123,6 +125,8 @@ JsModule { l_angle_token: L_ANGLE@117..118 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@118..119 "T" [] [], }, @@ -562,6 +566,8 @@ JsModule { l_angle_token: L_ANGLE@266..268 "<" [] [Whitespace(" ")], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@268..269 "f" [] [], }, @@ -578,6 +584,8 @@ JsModule { l_angle_token: L_ANGLE@269..270 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@270..271 "T" [] [], }, @@ -891,10 +899,12 @@ JsModule { 0: L_ANGLE@114..116 "<" [] [Whitespace(" ")] 1: TS_TYPE_PARAMETER_LIST@116..117 0: TS_TYPE_PARAMETER@116..117 - 0: TS_TYPE_PARAMETER_NAME@116..117 - 0: IDENT@116..117 "f" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@116..117 + 0: IDENT@116..117 "f" [] [] + 3: (empty) + 4: (empty) 2: (empty) 1: (empty) 2: (empty) @@ -903,10 +913,12 @@ JsModule { 0: L_ANGLE@117..118 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@118..119 0: TS_TYPE_PARAMETER@118..119 - 0: TS_TYPE_PARAMETER_NAME@118..119 - 0: IDENT@118..119 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@118..119 + 0: IDENT@118..119 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@119..120 ">" [] [] 1: (empty) 2: (empty) @@ -1184,10 +1196,12 @@ JsModule { 0: L_ANGLE@266..268 "<" [] [Whitespace(" ")] 1: TS_TYPE_PARAMETER_LIST@268..269 0: TS_TYPE_PARAMETER@268..269 - 0: TS_TYPE_PARAMETER_NAME@268..269 - 0: IDENT@268..269 "f" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@268..269 + 0: IDENT@268..269 "f" [] [] + 3: (empty) + 4: (empty) 2: (empty) 1: (empty) 2: (empty) @@ -1196,10 +1210,12 @@ JsModule { 0: L_ANGLE@269..270 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@270..271 0: TS_TYPE_PARAMETER@270..271 - 0: TS_TYPE_PARAMETER_NAME@270..271 - 0: IDENT@270..271 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@270..271 + 0: IDENT@270..271 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@271..272 ">" [] [] 1: (empty) 2: (empty) diff --git a/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast index afbc130ac10..c1be98c4ed8 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast @@ -18,6 +18,8 @@ JsModule { l_angle_token: L_ANGLE@8..9 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@9..10 "A" [] [], }, @@ -75,10 +77,12 @@ JsModule { 0: L_ANGLE@8..9 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@9..10 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@10..11 ">" [] [] 3: L_PAREN@11..12 "(" [] [] 4: R_PAREN@12..13 ")" [] [] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast index cd9ca1da8bf..1e907648735 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast @@ -18,6 +18,8 @@ JsModule { l_angle_token: L_ANGLE@8..9 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@9..10 "A" [] [], }, @@ -82,10 +84,12 @@ JsModule { 0: L_ANGLE@8..9 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@9..10 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@10..11 ">" [] [] 3: L_PAREN@11..12 "(" [] [] 4: JS_FORMAL_PARAMETER@12..20 diff --git a/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast index afef03a5236..f5b6f89bc3d 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..8 "T" [] [], }, @@ -40,10 +42,12 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..8 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "T" [] [] + 3: (empty) + 4: (empty) 2: (empty) 3: (empty) 4: (empty) diff --git a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast new file mode 100644 index 00000000000..650e3bf8ebb --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.rast @@ -0,0 +1,980 @@ +JsModule { + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsBogusStatement { + items: [ + TYPE_KW@0..5 "type" [] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@5..8 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@8..9 "<" [] [], + JsBogus { + items: [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@9..10 "i" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsBogusType { + items: [ + ERROR_TOKEN@10..11 "\\" [] [], + ], + }, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@11..18 "\\u006E" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@18..19 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@19..21 ">" [] [Whitespace(" ")], + ], + }, + EQ@21..23 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@23..24 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@24..25 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@31..34 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@34..35 "<" [] [], + JsBogus { + items: [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@35..37 "ou" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsBogusType { + items: [ + ERROR_TOKEN@37..38 "\\" [] [], + ], + }, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@38..45 "\\u0074" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@45..46 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@46..48 ">" [] [Whitespace(" ")], + ], + }, + EQ@48..50 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@50..51 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@51..52 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@58..61 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@61..62 "<" [] [], + JsBogus { + items: [ + IN_KW@62..65 "in" [] [Whitespace(" ")], + TsBogusType { + items: [ + IN_KW@65..67 "in" [] [], + ], + }, + ], + }, + R_ANGLE@67..69 ">" [] [Whitespace(" ")], + ], + }, + EQ@69..71 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@71..72 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@72..73 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@79..82 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@82..83 "<" [] [], + JsBogus { + items: [ + OUT_KW@83..87 "out" [] [Whitespace(" ")], + TsBogusType { + items: [ + IN_KW@87..89 "in" [] [], + ], + }, + ], + }, + R_ANGLE@89..91 ">" [] [Whitespace(" ")], + ], + }, + EQ@91..93 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@93..94 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@94..95 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@101..104 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@104..105 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + OUT_KW@105..109 "out" [] [Whitespace(" ")], + IN_KW@109..112 "in" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@112..113 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@113..115 ">" [] [Whitespace(" ")], + ], + }, + EQ@115..117 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@117..118 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@118..119 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@119..125 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@125..128 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@128..129 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + JsBogus { + items: [ + IDENT@129..136 "public" [] [Whitespace(" ")], + ], + }, + ], + }, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@136..137 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + }, + R_ANGLE@137..139 ">" [] [Whitespace(" ")], + ], + }, + EQ@139..141 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@141..142 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@142..143 "}" [] [], + }, + ], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@149..152 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@152..153 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@153..158 "innn" [] [Whitespace(" ")], + }, + constraint: missing (optional), + default: missing (optional), + }, + missing separator, + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@158..159 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@159..161 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@161..163 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@163..164 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@164..165 "}" [] [], + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@171..174 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@174..175 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@175..178 "in" [] [Whitespace(" ")], + OUT_KW@178..182 "out" [] [Whitespace(" ")], + IN_KW@182..185 "in" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@185..186 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@186..188 ">" [] [Whitespace(" ")], + ], + }, + EQ@188..190 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@190..191 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@191..192 "}" [] [], + }, + ], + }, + JsBogusStatement { + items: [ + TYPE_KW@192..198 "type" [Newline("\n")] [Whitespace(" ")], + TsIdentifierBinding { + name_token: IDENT@198..201 "Foo" [] [], + }, + JsBogus { + items: [ + L_ANGLE@201..202 "<" [] [], + JsBogus { + items: [ + JsBogus { + items: [ + IN_KW@202..205 "in" [] [Whitespace(" ")], + OUT_KW@205..209 "out" [] [Whitespace(" ")], + OUT_KW@209..213 "out" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@213..214 "T" [] [], + }, + ], + }, + ], + }, + R_ANGLE@214..216 ">" [] [Whitespace(" ")], + ], + }, + EQ@216..218 "=" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@218..219 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@219..220 "}" [] [], + }, + ], + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@220..230 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@230..233 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@233..234 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@234..237 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@237..238 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@238..239 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@239..240 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@240..242 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@242..243 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@243..244 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@244..254 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@254..257 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@257..258 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@258..262 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@262..263 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@263..264 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@264..265 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@265..267 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@267..268 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@268..269 "}" [] [], + }, + }, + ], + eof_token: EOF@269..270 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..270 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..269 + 0: JS_BOGUS_STATEMENT@0..25 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..8 + 0: IDENT@5..8 "Foo" [] [] + 2: JS_BOGUS@8..21 + 0: L_ANGLE@8..9 "<" [] [] + 1: JS_BOGUS@9..19 + 0: TS_TYPE_PARAMETER@9..10 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "i" [] [] + 3: (empty) + 4: (empty) + 1: TS_BOGUS_TYPE@10..11 + 0: ERROR_TOKEN@10..11 "\\" [] [] + 2: TS_TYPE_PARAMETER@11..18 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@11..18 + 0: IDENT@11..18 "\\u006E" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 3: TS_TYPE_PARAMETER@18..19 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@18..19 + 0: IDENT@18..19 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@19..21 ">" [] [Whitespace(" ")] + 3: EQ@21..23 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@23..25 + 0: L_CURLY@23..24 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@24..24 + 2: R_CURLY@24..25 "}" [] [] + 1: JS_BOGUS_STATEMENT@25..52 + 0: TYPE_KW@25..31 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@31..34 + 0: IDENT@31..34 "Foo" [] [] + 2: JS_BOGUS@34..48 + 0: L_ANGLE@34..35 "<" [] [] + 1: JS_BOGUS@35..46 + 0: TS_TYPE_PARAMETER@35..37 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@35..37 + 0: IDENT@35..37 "ou" [] [] + 3: (empty) + 4: (empty) + 1: TS_BOGUS_TYPE@37..38 + 0: ERROR_TOKEN@37..38 "\\" [] [] + 2: TS_TYPE_PARAMETER@38..45 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@38..45 + 0: IDENT@38..45 "\\u0074" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 3: TS_TYPE_PARAMETER@45..46 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@45..46 + 0: IDENT@45..46 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@46..48 ">" [] [Whitespace(" ")] + 3: EQ@48..50 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@50..52 + 0: L_CURLY@50..51 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@51..51 + 2: R_CURLY@51..52 "}" [] [] + 2: JS_BOGUS_STATEMENT@52..73 + 0: TYPE_KW@52..58 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@58..61 + 0: IDENT@58..61 "Foo" [] [] + 2: JS_BOGUS@61..69 + 0: L_ANGLE@61..62 "<" [] [] + 1: JS_BOGUS@62..67 + 0: IN_KW@62..65 "in" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@65..67 + 0: IN_KW@65..67 "in" [] [] + 2: R_ANGLE@67..69 ">" [] [Whitespace(" ")] + 3: EQ@69..71 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@71..73 + 0: L_CURLY@71..72 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@72..72 + 2: R_CURLY@72..73 "}" [] [] + 3: JS_BOGUS_STATEMENT@73..95 + 0: TYPE_KW@73..79 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@79..82 + 0: IDENT@79..82 "Foo" [] [] + 2: JS_BOGUS@82..91 + 0: L_ANGLE@82..83 "<" [] [] + 1: JS_BOGUS@83..89 + 0: OUT_KW@83..87 "out" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@87..89 + 0: IN_KW@87..89 "in" [] [] + 2: R_ANGLE@89..91 ">" [] [Whitespace(" ")] + 3: EQ@91..93 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@93..95 + 0: L_CURLY@93..94 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@94..94 + 2: R_CURLY@94..95 "}" [] [] + 4: JS_BOGUS_STATEMENT@95..119 + 0: TYPE_KW@95..101 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@101..104 + 0: IDENT@101..104 "Foo" [] [] + 2: JS_BOGUS@104..115 + 0: L_ANGLE@104..105 "<" [] [] + 1: JS_BOGUS@105..113 + 0: JS_BOGUS@105..113 + 0: OUT_KW@105..109 "out" [] [Whitespace(" ")] + 1: IN_KW@109..112 "in" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@112..113 + 0: IDENT@112..113 "T" [] [] + 2: R_ANGLE@113..115 ">" [] [Whitespace(" ")] + 3: EQ@115..117 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@117..119 + 0: L_CURLY@117..118 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@118..118 + 2: R_CURLY@118..119 "}" [] [] + 5: JS_BOGUS_STATEMENT@119..143 + 0: TYPE_KW@119..125 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@125..128 + 0: IDENT@125..128 "Foo" [] [] + 2: JS_BOGUS@128..139 + 0: L_ANGLE@128..129 "<" [] [] + 1: JS_BOGUS@129..137 + 0: JS_BOGUS@129..136 + 0: JS_BOGUS@129..136 + 0: IDENT@129..136 "public" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER@136..137 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@136..137 + 0: IDENT@136..137 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@137..139 ">" [] [Whitespace(" ")] + 3: EQ@139..141 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@141..143 + 0: L_CURLY@141..142 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@142..142 + 2: R_CURLY@142..143 "}" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@143..165 + 0: TYPE_KW@143..149 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@149..152 + 0: IDENT@149..152 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@152..161 + 0: L_ANGLE@152..153 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@153..159 + 0: TS_TYPE_PARAMETER@153..158 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@153..158 + 0: IDENT@153..158 "innn" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER@158..159 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@158..159 + 0: IDENT@158..159 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@159..161 ">" [] [Whitespace(" ")] + 3: EQ@161..163 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@163..165 + 0: L_CURLY@163..164 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@164..164 + 2: R_CURLY@164..165 "}" [] [] + 5: (empty) + 7: JS_BOGUS_STATEMENT@165..192 + 0: TYPE_KW@165..171 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@171..174 + 0: IDENT@171..174 "Foo" [] [] + 2: JS_BOGUS@174..188 + 0: L_ANGLE@174..175 "<" [] [] + 1: JS_BOGUS@175..186 + 0: JS_BOGUS@175..186 + 0: IN_KW@175..178 "in" [] [Whitespace(" ")] + 1: OUT_KW@178..182 "out" [] [Whitespace(" ")] + 2: IN_KW@182..185 "in" [] [Whitespace(" ")] + 3: TS_TYPE_PARAMETER_NAME@185..186 + 0: IDENT@185..186 "T" [] [] + 2: R_ANGLE@186..188 ">" [] [Whitespace(" ")] + 3: EQ@188..190 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@190..192 + 0: L_CURLY@190..191 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@191..191 + 2: R_CURLY@191..192 "}" [] [] + 8: JS_BOGUS_STATEMENT@192..220 + 0: TYPE_KW@192..198 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@198..201 + 0: IDENT@198..201 "Foo" [] [] + 2: JS_BOGUS@201..216 + 0: L_ANGLE@201..202 "<" [] [] + 1: JS_BOGUS@202..214 + 0: JS_BOGUS@202..214 + 0: IN_KW@202..205 "in" [] [Whitespace(" ")] + 1: OUT_KW@205..209 "out" [] [Whitespace(" ")] + 2: OUT_KW@209..213 "out" [] [Whitespace(" ")] + 3: TS_TYPE_PARAMETER_NAME@213..214 + 0: IDENT@213..214 "T" [] [] + 2: R_ANGLE@214..216 ">" [] [Whitespace(" ")] + 3: EQ@216..218 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@218..220 + 0: L_CURLY@218..219 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@219..219 + 2: R_CURLY@219..220 "}" [] [] + 9: JS_FUNCTION_DECLARATION@220..244 + 0: (empty) + 1: FUNCTION_KW@220..230 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@230..233 + 0: IDENT@230..233 "foo" [] [] + 4: TS_TYPE_PARAMETERS@233..239 + 0: L_ANGLE@233..234 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@234..238 + 0: TS_TYPE_PARAMETER@234..238 + 0: IN_KW@234..237 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@237..238 + 0: IDENT@237..238 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@238..239 ">" [] [] + 5: JS_PARAMETERS@239..242 + 0: L_PAREN@239..240 "(" [] [] + 1: JS_PARAMETER_LIST@240..240 + 2: R_PAREN@240..242 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@242..244 + 0: L_CURLY@242..243 "{" [] [] + 1: JS_DIRECTIVE_LIST@243..243 + 2: JS_STATEMENT_LIST@243..243 + 3: R_CURLY@243..244 "}" [] [] + 10: JS_FUNCTION_DECLARATION@244..269 + 0: (empty) + 1: FUNCTION_KW@244..254 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@254..257 + 0: IDENT@254..257 "foo" [] [] + 4: TS_TYPE_PARAMETERS@257..264 + 0: L_ANGLE@257..258 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@258..263 + 0: TS_TYPE_PARAMETER@258..263 + 0: (empty) + 1: OUT_KW@258..262 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@262..263 + 0: IDENT@262..263 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@263..264 ">" [] [] + 5: JS_PARAMETERS@264..267 + 0: L_PAREN@264..265 "(" [] [] + 1: JS_PARAMETER_LIST@265..265 + 2: R_PAREN@265..267 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@267..269 + 0: L_CURLY@267..268 "{" [] [] + 1: JS_DIRECTIVE_LIST@268..268 + 2: JS_STATEMENT_LIST@268..268 + 3: R_CURLY@268..269 "}" [] [] + 3: EOF@269..270 "" [Newline("\n")] [] +-- +type_parameter_modifier.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected token `\` + + > 1 │ type Foo = {} + │ ^ + 2 │ type Foo = {} + 3 │ type Foo = {} + +-- +type_parameter_modifier.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `\u006E` + + > 1 │ type Foo = {} + │ ^^^^^^ + 2 │ type Foo = {} + 3 │ type Foo = {} + + i Remove \u006E + +-- +type_parameter_modifier.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + > 1 │ type Foo = {} + │ ^ + 2 │ type Foo = {} + 3 │ type Foo = {} + + i Remove T + +-- +type_parameter_modifier.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × unexpected token `\` + + 1 │ type Foo = {} + > 2 │ type Foo = {} + │ ^ + 3 │ type Foo = {} + 4 │ type Foo = {} + +-- +type_parameter_modifier.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `\u0074` + + 1 │ type Foo = {} + > 2 │ type Foo = {} + │ ^^^^^^ + 3 │ type Foo = {} + 4 │ type Foo = {} + + i Remove \u0074 + +-- +type_parameter_modifier.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 1 │ type Foo = {} + > 2 │ type Foo = {} + │ ^ + 3 │ type Foo = {} + 4 │ type Foo = {} + + i Remove T + +-- +type_parameter_modifier.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a type parameter but instead found 'in' + + 1 │ type Foo = {} + 2 │ type Foo = {} + > 3 │ type Foo = {} + │ ^^ + 4 │ type Foo = {} + 5 │ type Foo = {} + + i Expected a type parameter here + + 1 │ type Foo = {} + 2 │ type Foo = {} + > 3 │ type Foo = {} + │ ^^ + 4 │ type Foo = {} + 5 │ type Foo = {} + +-- +type_parameter_modifier.ts:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a type parameter but instead found 'in' + + 2 │ type Foo = {} + 3 │ type Foo = {} + > 4 │ type Foo = {} + │ ^^ + 5 │ type Foo = {} + 6 │ type Foo = {} + + i Expected a type parameter here + + 2 │ type Foo = {} + 3 │ type Foo = {} + > 4 │ type Foo = {} + │ ^^ + 5 │ type Foo = {} + 6 │ type Foo = {} + +-- +type_parameter_modifier.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' must precede 'out' + + 3 │ type Foo = {} + 4 │ type Foo = {} + > 5 │ type Foo = {} + │ ^^ + 6 │ type Foo = {} + 7 │ type Foo = {} + + i move this modifier + + 3 │ type Foo = {} + 4 │ type Foo = {} + > 5 │ type Foo = {} + │ ^^ + 6 │ type Foo = {} + 7 │ type Foo = {} + + i before this modifier + + 3 │ type Foo = {} + 4 │ type Foo = {} + > 5 │ type Foo = {} + │ ^^^ + 6 │ type Foo = {} + 7 │ type Foo = {} + +-- +type_parameter_modifier.ts:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `public` as an identifier in strict mode + + 4 │ type Foo = {} + 5 │ type Foo = {} + > 6 │ type Foo = {} + │ ^^^^^^ + 7 │ type Foo = {} + 8 │ type Foo = {} + +-- +type_parameter_modifier.ts:6:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 4 │ type Foo = {} + 5 │ type Foo = {} + > 6 │ type Foo = {} + │ ^ + 7 │ type Foo = {} + 8 │ type Foo = {} + + i Remove T + +-- +type_parameter_modifier.ts:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 5 │ type Foo = {} + 6 │ type Foo = {} + > 7 │ type Foo = {} + │ ^ + 8 │ type Foo = {} + 9 │ type Foo = {} + + i Remove T + +-- +type_parameter_modifier.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' already seen + + 6 │ type Foo = {} + 7 │ type Foo = {} + > 8 │ type Foo = {} + │ ^^ + 9 │ type Foo = {} + 10 │ function foo() {} + + i duplicate modifier + + 6 │ type Foo = {} + 7 │ type Foo = {} + > 8 │ type Foo = {} + │ ^^ + 9 │ type Foo = {} + 10 │ function foo() {} + + i first seen here + + 6 │ type Foo = {} + 7 │ type Foo = {} + > 8 │ type Foo = {} + │ ^^ + 9 │ type Foo = {} + 10 │ function foo() {} + +-- +type_parameter_modifier.ts:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' already seen + + 7 │ type Foo = {} + 8 │ type Foo = {} + > 9 │ type Foo = {} + │ ^^^ + 10 │ function foo() {} + 11 │ function foo() {} + + i duplicate modifier + + 7 │ type Foo = {} + 8 │ type Foo = {} + > 9 │ type Foo = {} + │ ^^^ + 10 │ function foo() {} + 11 │ function foo() {} + + i first seen here + + 7 │ type Foo = {} + 8 │ type Foo = {} + > 9 │ type Foo = {} + │ ^^^ + 10 │ function foo() {} + 11 │ function foo() {} + +-- +type_parameter_modifier.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 8 │ type Foo = {} + 9 │ type Foo = {} + > 10 │ function foo() {} + │ ^^ + 11 │ function foo() {} + 12 │ + +-- +type_parameter_modifier.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 9 │ type Foo = {} + 10 │ function foo() {} + > 11 │ function foo() {} + │ ^^^ + 12 │ + +-- +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +function foo() {} +function foo() {} diff --git a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.ts b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.ts new file mode 100644 index 00000000000..b87336dc431 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier.ts @@ -0,0 +1,11 @@ +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +function foo() {} +function foo() {} diff --git a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.rast b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.rast new file mode 100644 index 00000000000..d44821a3a17 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.rast @@ -0,0 +1,2785 @@ +JsModule { + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExport { + export_token: EXPORT_KW@0..7 "export" [] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")], + declaration: JsFunctionExportDefaultDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@24..27 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@27..28 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@28..31 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@31..32 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@32..33 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@33..34 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@34..36 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@36..37 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + }, + semicolon_token: missing (optional), + }, + }, + JsExport { + export_token: EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@46..55 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@55..58 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@58..59 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@59..63 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@63..64 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@64..65 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@65..66 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@66..68 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@68..69 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@69..70 "}" [] [], + }, + }, + }, + JsExport { + export_token: EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@78..87 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@87..91 "foo1" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@91..92 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@92..95 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@95..96 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@96..97 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@97..98 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@98..100 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@100..101 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@101..102 "}" [] [], + }, + }, + }, + JsExport { + export_token: EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@110..119 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@119..123 "foo2" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@123..124 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@124..128 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@128..129 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@129..130 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@130..131 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@131..133 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@133..134 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@134..135 "}" [] [], + }, + }, + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@140..143 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@143..145 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@145..148 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@148..149 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@149..152 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@152..153 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@153..154 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@159..162 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@162..164 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@164..167 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@167..168 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@168..172 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@172..173 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@173..174 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + TsDeclareStatement { + declare_token: DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@183..192 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@192..195 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@195..196 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@196..199 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@199..200 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@200..201 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@201..202 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@202..203 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsDeclareFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@212..221 "function" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@221..224 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@224..225 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@225..229 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@229..230 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@230..231 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@231..232 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@232..233 ")" [] [], + }, + return_type_annotation: missing (optional), + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + kind: LET_KW@242..246 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@246..249 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@249..251 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@251..254 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@254..255 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@255..258 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@258..259 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@259..260 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsVariableDeclarationClause { + declaration: JsVariableDeclaration { + kind: LET_KW@269..273 "let" [] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@273..276 "foo" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@276..278 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@278..281 "Foo" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@281..282 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@282..286 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + missing separator, + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@286..287 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@287..288 ">" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@293..295 "=" [] [Whitespace(" ")], + right: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@295..304 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@304..305 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@305..308 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@308..309 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@309..310 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@310..311 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@311..313 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@313..314 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@314..315 "}" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@320..322 "=" [] [Whitespace(" ")], + right: JsFunctionExpression { + async_token: missing (optional), + function_token: FUNCTION_KW@322..331 "function" [] [Whitespace(" ")], + star_token: missing (optional), + id: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@331..332 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@332..336 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@336..337 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@337..338 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@338..339 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@339..341 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@341..342 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@342..343 "}" [] [], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@350..354 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@354..356 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@356..359 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@359..360 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@360..363 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@363..364 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@364..365 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@365..366 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@366..367 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@367..369 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@369..371 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@371..372 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@372..374 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@374..375 "}" [] [], + }, + JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@382..386 "Foo" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@386..388 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsMethodClassMember { + modifiers: JsMethodModifierList [], + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@388..391 "foo" [] [], + }, + question_mark_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@391..392 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@392..396 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@396..397 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@397..398 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@398..399 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@399..400 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@400..402 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@402..404 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@404..405 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@405..407 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@407..408 "}" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@413..415 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@415..417 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@417..420 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@420..421 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@421..424 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@424..425 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@425..426 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@426..427 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@427..428 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@428..430 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@430..432 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@432..433 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@433..435 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@435..436 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@436..437 ";" [] [], + }, + JsExpressionStatement { + expression: JsAssignmentExpression { + left: JsIdentifierAssignment { + name_token: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")], + }, + operator_token: EQ@442..444 "=" [] [Whitespace(" ")], + right: JsObjectExpression { + l_curly_token: L_CURLY@444..446 "{" [] [Whitespace(" ")], + members: JsObjectMemberList [ + JsMethodObjectMember { + async_token: missing (optional), + star_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@446..449 "foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@449..450 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@450..454 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@454..455 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@455..456 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@456..457 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@457..458 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@458..460 ":" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@460..462 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@462..463 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@463..465 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@465..466 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@466..467 ";" [] [], + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@467..469 "<" [Newline("\n")] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@469..472 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + r_angle_token: missing (required), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@472..473 "T" [] [], + }, + }, + }, + operator_token: R_ANGLE@473..474 ">" [] [], + right: JsParenthesizedExpression { + l_paren_token: L_PAREN@474..475 "(" [] [], + expression: missing (required), + r_paren_token: R_PAREN@475..477 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + FAT_ARROW@477..480 "=>" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@480..481 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@481..482 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@482..483 ";" [] [], + }, + JsExpressionStatement { + expression: JsArrowFunctionExpression { + async_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@483..485 "<" [Newline("\n")] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@485..489 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@489..490 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@490..491 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@491..492 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@492..494 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + fat_arrow_token: FAT_ARROW@494..497 "=>" [] [Whitespace(" ")], + body: JsFunctionBody { + l_curly_token: L_CURLY@497..498 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@498..499 "}" [] [], + }, + }, + semicolon_token: SEMICOLON@499..500 ";" [] [], + }, + JsExpressionStatement { + expression: JsSequenceExpression { + left: TsTypeAssertionExpression { + l_angle_token: L_ANGLE@500..502 "<" [Newline("\n")] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@502..505 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + r_angle_token: missing (required), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@505..506 "T" [] [], + }, + }, + }, + comma_token: COMMA@506..508 "," [] [Whitespace(" ")], + right: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@508..512 "out" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + }, + JsExpressionStatement { + expression: JsBinaryExpression { + left: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@512..513 "T" [] [], + }, + }, + operator_token: R_ANGLE@513..514 ">" [] [], + right: JsParenthesizedExpression { + l_paren_token: L_PAREN@514..515 "(" [] [], + expression: missing (required), + r_paren_token: R_PAREN@515..517 ")" [] [Whitespace(" ")], + }, + }, + semicolon_token: missing (optional), + }, + JsBogusStatement { + items: [ + FAT_ARROW@517..520 "=>" [] [Whitespace(" ")], + ], + }, + JsBlockStatement { + l_curly_token: L_CURLY@520..521 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@521..522 "}" [] [], + }, + JsEmptyStatement { + semicolon_token: SEMICOLON@522..523 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@528..529 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@529..531 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@531..532 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@532..535 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@535..536 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@536..537 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@537..538 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@538..540 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@540..543 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@543..544 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@544..545 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@545..546 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@551..552 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@552..554 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@554..555 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@555..559 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@559..560 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@560..561 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@561..562 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@562..564 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@564..567 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@567..568 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@568..569 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@569..570 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@575..576 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@576..578 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@578..579 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@579..582 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@582..583 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@583..585 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@585..589 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@589..590 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@590..591 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@591..592 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@592..594 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@594..597 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@597..598 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@598..599 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@599..600 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@605..606 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@606..608 ":" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@608..612 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@612..613 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@613..616 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@616..617 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@617..618 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@618..619 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@619..621 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@621..624 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@624..625 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@625..626 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@626..627 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@632..633 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@633..635 ":" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@635..639 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@639..640 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@640..644 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@644..645 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@645..646 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@646..647 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@647..649 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@649..652 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@652..653 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@653..654 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@654..655 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@660..661 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@661..663 ":" [] [Whitespace(" ")], + ty: TsConstructorType { + abstract_token: missing (optional), + new_token: NEW_KW@663..667 "new" [] [Whitespace(" ")], + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@667..668 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@668..671 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@671..672 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@672..674 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@674..678 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@678..679 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@679..680 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@680..681 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@681..683 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@683..686 "=>" [] [Whitespace(" ")], + return_type: TsObjectType { + l_curly_token: L_CURLY@686..687 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@687..688 "}" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@688..689 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@694..695 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@695..697 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@697..699 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@699..700 "y" [] [], + }, + optional_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@700..701 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@701..704 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@704..705 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@705..706 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@706..707 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@707..708 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@708..710 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@710..714 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@714..715 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@715..716 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@721..722 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@722..724 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@724..726 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@726..727 "y" [] [], + }, + optional_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@727..728 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@728..732 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@732..733 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@733..734 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@734..735 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@735..736 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@736..738 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@738..742 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@742..743 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@743..744 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + kind: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@749..750 "x" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@750..752 ":" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@752..754 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@754..755 "y" [] [], + }, + optional_token: missing (optional), + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@755..756 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@756..759 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@759..760 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@760..762 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@762..766 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@766..767 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@767..768 ">" [] [], + }, + parameters: JsParameters { + l_paren_token: L_PAREN@768..769 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@769..770 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@770..772 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@772..776 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@776..777 "}" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@777..778 ";" [] [], + }, + ], + eof_token: EOF@778..779 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..779 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..778 + 0: JS_EXPORT@0..38 + 0: EXPORT_KW@0..7 "export" [] [Whitespace(" ")] + 1: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@7..38 + 0: DEFAULT_KW@7..15 "default" [] [Whitespace(" ")] + 1: JS_FUNCTION_EXPORT_DEFAULT_DECLARATION@15..38 + 0: (empty) + 1: FUNCTION_KW@15..24 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@24..27 + 0: IDENT@24..27 "foo" [] [] + 4: TS_TYPE_PARAMETERS@27..33 + 0: L_ANGLE@27..28 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@28..32 + 0: TS_TYPE_PARAMETER@28..32 + 0: IN_KW@28..31 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@31..32 + 0: IDENT@31..32 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@32..33 ">" [] [] + 5: JS_PARAMETERS@33..36 + 0: L_PAREN@33..34 "(" [] [] + 1: JS_PARAMETER_LIST@34..34 + 2: R_PAREN@34..36 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: JS_DIRECTIVE_LIST@37..37 + 2: JS_STATEMENT_LIST@37..37 + 3: R_CURLY@37..38 "}" [] [] + 2: (empty) + 1: JS_EXPORT@38..70 + 0: EXPORT_KW@38..46 "export" [Newline("\n")] [Whitespace(" ")] + 1: JS_FUNCTION_DECLARATION@46..70 + 0: (empty) + 1: FUNCTION_KW@46..55 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@55..58 + 0: IDENT@55..58 "foo" [] [] + 4: TS_TYPE_PARAMETERS@58..65 + 0: L_ANGLE@58..59 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@59..64 + 0: TS_TYPE_PARAMETER@59..64 + 0: (empty) + 1: OUT_KW@59..63 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@63..64 + 0: IDENT@63..64 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@64..65 ">" [] [] + 5: JS_PARAMETERS@65..68 + 0: L_PAREN@65..66 "(" [] [] + 1: JS_PARAMETER_LIST@66..66 + 2: R_PAREN@66..68 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@68..70 + 0: L_CURLY@68..69 "{" [] [] + 1: JS_DIRECTIVE_LIST@69..69 + 2: JS_STATEMENT_LIST@69..69 + 3: R_CURLY@69..70 "}" [] [] + 2: JS_EXPORT@70..102 + 0: EXPORT_KW@70..78 "export" [Newline("\n")] [Whitespace(" ")] + 1: JS_FUNCTION_DECLARATION@78..102 + 0: (empty) + 1: FUNCTION_KW@78..87 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@87..91 + 0: IDENT@87..91 "foo1" [] [] + 4: TS_TYPE_PARAMETERS@91..97 + 0: L_ANGLE@91..92 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@92..96 + 0: TS_TYPE_PARAMETER@92..96 + 0: IN_KW@92..95 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@95..96 + 0: IDENT@95..96 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@96..97 ">" [] [] + 5: JS_PARAMETERS@97..100 + 0: L_PAREN@97..98 "(" [] [] + 1: JS_PARAMETER_LIST@98..98 + 2: R_PAREN@98..100 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@100..102 + 0: L_CURLY@100..101 "{" [] [] + 1: JS_DIRECTIVE_LIST@101..101 + 2: JS_STATEMENT_LIST@101..101 + 3: R_CURLY@101..102 "}" [] [] + 3: JS_EXPORT@102..135 + 0: EXPORT_KW@102..110 "export" [Newline("\n")] [Whitespace(" ")] + 1: JS_FUNCTION_DECLARATION@110..135 + 0: (empty) + 1: FUNCTION_KW@110..119 "function" [] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@119..123 + 0: IDENT@119..123 "foo2" [] [] + 4: TS_TYPE_PARAMETERS@123..130 + 0: L_ANGLE@123..124 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@124..129 + 0: TS_TYPE_PARAMETER@124..129 + 0: (empty) + 1: OUT_KW@124..128 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@128..129 + 0: IDENT@128..129 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@129..130 ">" [] [] + 5: JS_PARAMETERS@130..133 + 0: L_PAREN@130..131 "(" [] [] + 1: JS_PARAMETER_LIST@131..131 + 2: R_PAREN@131..133 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@133..135 + 0: L_CURLY@133..134 "{" [] [] + 1: JS_DIRECTIVE_LIST@134..134 + 2: JS_STATEMENT_LIST@134..134 + 3: R_CURLY@134..135 "}" [] [] + 4: JS_VARIABLE_STATEMENT@135..154 + 0: JS_VARIABLE_DECLARATION@135..154 + 0: LET_KW@135..140 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@140..154 + 0: JS_VARIABLE_DECLARATOR@140..154 + 0: JS_IDENTIFIER_BINDING@140..143 + 0: IDENT@140..143 "foo" [] [] + 1: TS_TYPE_ANNOTATION@143..154 + 0: COLON@143..145 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@145..154 + 0: JS_REFERENCE_IDENTIFIER@145..148 + 0: IDENT@145..148 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@148..154 + 0: L_ANGLE@148..149 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@149..153 + 0: TS_REFERENCE_TYPE@149..152 + 0: JS_REFERENCE_IDENTIFIER@149..152 + 0: IDENT@149..152 "in" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@152..153 + 0: JS_REFERENCE_IDENTIFIER@152..153 + 0: IDENT@152..153 "T" [] [] + 1: (empty) + 2: R_ANGLE@153..154 ">" [] [] + 2: (empty) + 1: (empty) + 5: JS_VARIABLE_STATEMENT@154..174 + 0: JS_VARIABLE_DECLARATION@154..174 + 0: LET_KW@154..159 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@159..174 + 0: JS_VARIABLE_DECLARATOR@159..174 + 0: JS_IDENTIFIER_BINDING@159..162 + 0: IDENT@159..162 "foo" [] [] + 1: TS_TYPE_ANNOTATION@162..174 + 0: COLON@162..164 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@164..174 + 0: JS_REFERENCE_IDENTIFIER@164..167 + 0: IDENT@164..167 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@167..174 + 0: L_ANGLE@167..168 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@168..173 + 0: TS_REFERENCE_TYPE@168..172 + 0: JS_REFERENCE_IDENTIFIER@168..172 + 0: IDENT@168..172 "out" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@172..173 + 0: JS_REFERENCE_IDENTIFIER@172..173 + 0: IDENT@172..173 "T" [] [] + 1: (empty) + 2: R_ANGLE@173..174 ">" [] [] + 2: (empty) + 1: (empty) + 6: TS_DECLARE_STATEMENT@174..203 + 0: DECLARE_KW@174..183 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@183..203 + 0: (empty) + 1: FUNCTION_KW@183..192 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@192..195 + 0: IDENT@192..195 "foo" [] [] + 3: TS_TYPE_PARAMETERS@195..201 + 0: L_ANGLE@195..196 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@196..200 + 0: TS_TYPE_PARAMETER@196..200 + 0: IN_KW@196..199 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@199..200 + 0: IDENT@199..200 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@200..201 ">" [] [] + 4: JS_PARAMETERS@201..203 + 0: L_PAREN@201..202 "(" [] [] + 1: JS_PARAMETER_LIST@202..202 + 2: R_PAREN@202..203 ")" [] [] + 5: (empty) + 6: (empty) + 7: TS_DECLARE_STATEMENT@203..233 + 0: DECLARE_KW@203..212 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_DECLARE_FUNCTION_DECLARATION@212..233 + 0: (empty) + 1: FUNCTION_KW@212..221 "function" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@221..224 + 0: IDENT@221..224 "foo" [] [] + 3: TS_TYPE_PARAMETERS@224..231 + 0: L_ANGLE@224..225 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@225..230 + 0: TS_TYPE_PARAMETER@225..230 + 0: (empty) + 1: OUT_KW@225..229 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@229..230 + 0: IDENT@229..230 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@230..231 ">" [] [] + 4: JS_PARAMETERS@231..233 + 0: L_PAREN@231..232 "(" [] [] + 1: JS_PARAMETER_LIST@232..232 + 2: R_PAREN@232..233 ")" [] [] + 5: (empty) + 6: (empty) + 8: TS_DECLARE_STATEMENT@233..260 + 0: DECLARE_KW@233..242 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@242..260 + 0: JS_VARIABLE_DECLARATION@242..260 + 0: LET_KW@242..246 "let" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@246..260 + 0: JS_VARIABLE_DECLARATOR@246..260 + 0: JS_IDENTIFIER_BINDING@246..249 + 0: IDENT@246..249 "foo" [] [] + 1: TS_TYPE_ANNOTATION@249..260 + 0: COLON@249..251 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@251..260 + 0: JS_REFERENCE_IDENTIFIER@251..254 + 0: IDENT@251..254 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@254..260 + 0: L_ANGLE@254..255 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@255..259 + 0: TS_REFERENCE_TYPE@255..258 + 0: JS_REFERENCE_IDENTIFIER@255..258 + 0: IDENT@255..258 "in" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@258..259 + 0: JS_REFERENCE_IDENTIFIER@258..259 + 0: IDENT@258..259 "T" [] [] + 1: (empty) + 2: R_ANGLE@259..260 ">" [] [] + 2: (empty) + 1: (empty) + 9: TS_DECLARE_STATEMENT@260..288 + 0: DECLARE_KW@260..269 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATION_CLAUSE@269..288 + 0: JS_VARIABLE_DECLARATION@269..288 + 0: LET_KW@269..273 "let" [] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@273..288 + 0: JS_VARIABLE_DECLARATOR@273..288 + 0: JS_IDENTIFIER_BINDING@273..276 + 0: IDENT@273..276 "foo" [] [] + 1: TS_TYPE_ANNOTATION@276..288 + 0: COLON@276..278 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@278..288 + 0: JS_REFERENCE_IDENTIFIER@278..281 + 0: IDENT@278..281 "Foo" [] [] + 1: TS_TYPE_ARGUMENTS@281..288 + 0: L_ANGLE@281..282 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@282..287 + 0: TS_REFERENCE_TYPE@282..286 + 0: JS_REFERENCE_IDENTIFIER@282..286 + 0: IDENT@282..286 "out" [] [Whitespace(" ")] + 1: (empty) + 1: (empty) + 2: TS_REFERENCE_TYPE@286..287 + 0: JS_REFERENCE_IDENTIFIER@286..287 + 0: IDENT@286..287 "T" [] [] + 1: (empty) + 2: R_ANGLE@287..288 ">" [] [] + 2: (empty) + 1: (empty) + 10: JS_EXPRESSION_STATEMENT@288..315 + 0: JS_ASSIGNMENT_EXPRESSION@288..315 + 0: JS_IDENTIFIER_ASSIGNMENT@288..293 + 0: IDENT@288..293 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@293..295 "=" [] [Whitespace(" ")] + 2: JS_FUNCTION_EXPRESSION@295..315 + 0: (empty) + 1: FUNCTION_KW@295..304 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETERS@304..310 + 0: L_ANGLE@304..305 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@305..309 + 0: TS_TYPE_PARAMETER@305..309 + 0: IN_KW@305..308 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@308..309 + 0: IDENT@308..309 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@309..310 ">" [] [] + 5: JS_PARAMETERS@310..313 + 0: L_PAREN@310..311 "(" [] [] + 1: JS_PARAMETER_LIST@311..311 + 2: R_PAREN@311..313 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@313..315 + 0: L_CURLY@313..314 "{" [] [] + 1: JS_DIRECTIVE_LIST@314..314 + 2: JS_STATEMENT_LIST@314..314 + 3: R_CURLY@314..315 "}" [] [] + 1: (empty) + 11: JS_EXPRESSION_STATEMENT@315..343 + 0: JS_ASSIGNMENT_EXPRESSION@315..343 + 0: JS_IDENTIFIER_ASSIGNMENT@315..320 + 0: IDENT@315..320 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@320..322 "=" [] [Whitespace(" ")] + 2: JS_FUNCTION_EXPRESSION@322..343 + 0: (empty) + 1: FUNCTION_KW@322..331 "function" [] [Whitespace(" ")] + 2: (empty) + 3: (empty) + 4: TS_TYPE_PARAMETERS@331..338 + 0: L_ANGLE@331..332 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@332..337 + 0: TS_TYPE_PARAMETER@332..337 + 0: (empty) + 1: OUT_KW@332..336 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@336..337 + 0: IDENT@336..337 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@337..338 ">" [] [] + 5: JS_PARAMETERS@338..341 + 0: L_PAREN@338..339 "(" [] [] + 1: JS_PARAMETER_LIST@339..339 + 2: R_PAREN@339..341 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@341..343 + 0: L_CURLY@341..342 "{" [] [] + 1: JS_DIRECTIVE_LIST@342..342 + 2: JS_STATEMENT_LIST@342..342 + 3: R_CURLY@342..343 "}" [] [] + 1: (empty) + 12: JS_CLASS_DECLARATION@343..375 + 0: (empty) + 1: CLASS_KW@343..350 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@350..354 + 0: IDENT@350..354 "Foo" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@354..356 "{" [] [Whitespace(" ")] + 7: JS_CLASS_MEMBER_LIST@356..374 + 0: JS_METHOD_CLASS_MEMBER@356..374 + 0: JS_METHOD_MODIFIER_LIST@356..356 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@356..359 + 0: IDENT@356..359 "foo" [] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@359..365 + 0: L_ANGLE@359..360 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@360..364 + 0: TS_TYPE_PARAMETER@360..364 + 0: IN_KW@360..363 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@363..364 + 0: IDENT@363..364 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@364..365 ">" [] [] + 6: JS_PARAMETERS@365..367 + 0: L_PAREN@365..366 "(" [] [] + 1: JS_PARAMETER_LIST@366..366 + 2: R_PAREN@366..367 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@367..371 + 0: COLON@367..369 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@369..371 + 0: JS_REFERENCE_IDENTIFIER@369..371 + 0: IDENT@369..371 "T" [] [Whitespace(" ")] + 1: (empty) + 8: JS_FUNCTION_BODY@371..374 + 0: L_CURLY@371..372 "{" [] [] + 1: JS_DIRECTIVE_LIST@372..372 + 2: JS_STATEMENT_LIST@372..372 + 3: R_CURLY@372..374 "}" [] [Whitespace(" ")] + 8: R_CURLY@374..375 "}" [] [] + 13: JS_CLASS_DECLARATION@375..408 + 0: (empty) + 1: CLASS_KW@375..382 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@382..386 + 0: IDENT@382..386 "Foo" [] [Whitespace(" ")] + 3: (empty) + 4: (empty) + 5: (empty) + 6: L_CURLY@386..388 "{" [] [Whitespace(" ")] + 7: JS_CLASS_MEMBER_LIST@388..407 + 0: JS_METHOD_CLASS_MEMBER@388..407 + 0: JS_METHOD_MODIFIER_LIST@388..388 + 1: (empty) + 2: (empty) + 3: JS_LITERAL_MEMBER_NAME@388..391 + 0: IDENT@388..391 "foo" [] [] + 4: (empty) + 5: TS_TYPE_PARAMETERS@391..398 + 0: L_ANGLE@391..392 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@392..397 + 0: TS_TYPE_PARAMETER@392..397 + 0: (empty) + 1: OUT_KW@392..396 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@396..397 + 0: IDENT@396..397 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@397..398 ">" [] [] + 6: JS_PARAMETERS@398..400 + 0: L_PAREN@398..399 "(" [] [] + 1: JS_PARAMETER_LIST@399..399 + 2: R_PAREN@399..400 ")" [] [] + 7: TS_RETURN_TYPE_ANNOTATION@400..404 + 0: COLON@400..402 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@402..404 + 0: JS_REFERENCE_IDENTIFIER@402..404 + 0: IDENT@402..404 "T" [] [Whitespace(" ")] + 1: (empty) + 8: JS_FUNCTION_BODY@404..407 + 0: L_CURLY@404..405 "{" [] [] + 1: JS_DIRECTIVE_LIST@405..405 + 2: JS_STATEMENT_LIST@405..405 + 3: R_CURLY@405..407 "}" [] [Whitespace(" ")] + 8: R_CURLY@407..408 "}" [] [] + 14: JS_EXPRESSION_STATEMENT@408..437 + 0: JS_ASSIGNMENT_EXPRESSION@408..436 + 0: JS_IDENTIFIER_ASSIGNMENT@408..413 + 0: IDENT@408..413 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@413..415 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@415..436 + 0: L_CURLY@415..417 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@417..435 + 0: JS_METHOD_OBJECT_MEMBER@417..435 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@417..420 + 0: IDENT@417..420 "foo" [] [] + 3: TS_TYPE_PARAMETERS@420..426 + 0: L_ANGLE@420..421 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@421..425 + 0: TS_TYPE_PARAMETER@421..425 + 0: IN_KW@421..424 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@424..425 + 0: IDENT@424..425 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@425..426 ">" [] [] + 4: JS_PARAMETERS@426..428 + 0: L_PAREN@426..427 "(" [] [] + 1: JS_PARAMETER_LIST@427..427 + 2: R_PAREN@427..428 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@428..432 + 0: COLON@428..430 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@430..432 + 0: JS_REFERENCE_IDENTIFIER@430..432 + 0: IDENT@430..432 "T" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@432..435 + 0: L_CURLY@432..433 "{" [] [] + 1: JS_DIRECTIVE_LIST@433..433 + 2: JS_STATEMENT_LIST@433..433 + 3: R_CURLY@433..435 "}" [] [Whitespace(" ")] + 2: R_CURLY@435..436 "}" [] [] + 1: SEMICOLON@436..437 ";" [] [] + 15: JS_EXPRESSION_STATEMENT@437..467 + 0: JS_ASSIGNMENT_EXPRESSION@437..466 + 0: JS_IDENTIFIER_ASSIGNMENT@437..442 + 0: IDENT@437..442 "foo" [Newline("\n")] [Whitespace(" ")] + 1: EQ@442..444 "=" [] [Whitespace(" ")] + 2: JS_OBJECT_EXPRESSION@444..466 + 0: L_CURLY@444..446 "{" [] [Whitespace(" ")] + 1: JS_OBJECT_MEMBER_LIST@446..465 + 0: JS_METHOD_OBJECT_MEMBER@446..465 + 0: (empty) + 1: (empty) + 2: JS_LITERAL_MEMBER_NAME@446..449 + 0: IDENT@446..449 "foo" [] [] + 3: TS_TYPE_PARAMETERS@449..456 + 0: L_ANGLE@449..450 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@450..455 + 0: TS_TYPE_PARAMETER@450..455 + 0: (empty) + 1: OUT_KW@450..454 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@454..455 + 0: IDENT@454..455 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@455..456 ">" [] [] + 4: JS_PARAMETERS@456..458 + 0: L_PAREN@456..457 "(" [] [] + 1: JS_PARAMETER_LIST@457..457 + 2: R_PAREN@457..458 ")" [] [] + 5: TS_RETURN_TYPE_ANNOTATION@458..462 + 0: COLON@458..460 ":" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@460..462 + 0: JS_REFERENCE_IDENTIFIER@460..462 + 0: IDENT@460..462 "T" [] [Whitespace(" ")] + 1: (empty) + 6: JS_FUNCTION_BODY@462..465 + 0: L_CURLY@462..463 "{" [] [] + 1: JS_DIRECTIVE_LIST@463..463 + 2: JS_STATEMENT_LIST@463..463 + 3: R_CURLY@463..465 "}" [] [Whitespace(" ")] + 2: R_CURLY@465..466 "}" [] [] + 1: SEMICOLON@466..467 ";" [] [] + 16: JS_EXPRESSION_STATEMENT@467..477 + 0: JS_BINARY_EXPRESSION@467..477 + 0: TS_TYPE_ASSERTION_EXPRESSION@467..473 + 0: L_ANGLE@467..469 "<" [Newline("\n")] [] + 1: TS_REFERENCE_TYPE@469..472 + 0: JS_REFERENCE_IDENTIFIER@469..472 + 0: IDENT@469..472 "in" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_IDENTIFIER_EXPRESSION@472..473 + 0: JS_REFERENCE_IDENTIFIER@472..473 + 0: IDENT@472..473 "T" [] [] + 1: R_ANGLE@473..474 ">" [] [] + 2: JS_PARENTHESIZED_EXPRESSION@474..477 + 0: L_PAREN@474..475 "(" [] [] + 1: (empty) + 2: R_PAREN@475..477 ")" [] [Whitespace(" ")] + 1: (empty) + 17: JS_BOGUS_STATEMENT@477..480 + 0: FAT_ARROW@477..480 "=>" [] [Whitespace(" ")] + 18: JS_BLOCK_STATEMENT@480..482 + 0: L_CURLY@480..481 "{" [] [] + 1: JS_STATEMENT_LIST@481..481 + 2: R_CURLY@481..482 "}" [] [] + 19: JS_EMPTY_STATEMENT@482..483 + 0: SEMICOLON@482..483 ";" [] [] + 20: JS_EXPRESSION_STATEMENT@483..500 + 0: JS_ARROW_FUNCTION_EXPRESSION@483..499 + 0: (empty) + 1: TS_TYPE_PARAMETERS@483..491 + 0: L_ANGLE@483..485 "<" [Newline("\n")] [] + 1: TS_TYPE_PARAMETER_LIST@485..490 + 0: TS_TYPE_PARAMETER@485..490 + 0: (empty) + 1: OUT_KW@485..489 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@489..490 + 0: IDENT@489..490 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@490..491 ">" [] [] + 2: JS_PARAMETERS@491..494 + 0: L_PAREN@491..492 "(" [] [] + 1: JS_PARAMETER_LIST@492..492 + 2: R_PAREN@492..494 ")" [] [Whitespace(" ")] + 3: (empty) + 4: FAT_ARROW@494..497 "=>" [] [Whitespace(" ")] + 5: JS_FUNCTION_BODY@497..499 + 0: L_CURLY@497..498 "{" [] [] + 1: JS_DIRECTIVE_LIST@498..498 + 2: JS_STATEMENT_LIST@498..498 + 3: R_CURLY@498..499 "}" [] [] + 1: SEMICOLON@499..500 ";" [] [] + 21: JS_EXPRESSION_STATEMENT@500..512 + 0: JS_SEQUENCE_EXPRESSION@500..512 + 0: TS_TYPE_ASSERTION_EXPRESSION@500..506 + 0: L_ANGLE@500..502 "<" [Newline("\n")] [] + 1: TS_REFERENCE_TYPE@502..505 + 0: JS_REFERENCE_IDENTIFIER@502..505 + 0: IDENT@502..505 "in" [] [Whitespace(" ")] + 1: (empty) + 2: (empty) + 3: JS_IDENTIFIER_EXPRESSION@505..506 + 0: JS_REFERENCE_IDENTIFIER@505..506 + 0: IDENT@505..506 "T" [] [] + 1: COMMA@506..508 "," [] [Whitespace(" ")] + 2: JS_IDENTIFIER_EXPRESSION@508..512 + 0: JS_REFERENCE_IDENTIFIER@508..512 + 0: IDENT@508..512 "out" [] [Whitespace(" ")] + 1: (empty) + 22: JS_EXPRESSION_STATEMENT@512..517 + 0: JS_BINARY_EXPRESSION@512..517 + 0: JS_IDENTIFIER_EXPRESSION@512..513 + 0: JS_REFERENCE_IDENTIFIER@512..513 + 0: IDENT@512..513 "T" [] [] + 1: R_ANGLE@513..514 ">" [] [] + 2: JS_PARENTHESIZED_EXPRESSION@514..517 + 0: L_PAREN@514..515 "(" [] [] + 1: (empty) + 2: R_PAREN@515..517 ")" [] [Whitespace(" ")] + 1: (empty) + 23: JS_BOGUS_STATEMENT@517..520 + 0: FAT_ARROW@517..520 "=>" [] [Whitespace(" ")] + 24: JS_BLOCK_STATEMENT@520..522 + 0: L_CURLY@520..521 "{" [] [] + 1: JS_STATEMENT_LIST@521..521 + 2: R_CURLY@521..522 "}" [] [] + 25: JS_EMPTY_STATEMENT@522..523 + 0: SEMICOLON@522..523 ";" [] [] + 26: JS_VARIABLE_STATEMENT@523..546 + 0: JS_VARIABLE_DECLARATION@523..545 + 0: LET_KW@523..528 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@528..545 + 0: JS_VARIABLE_DECLARATOR@528..545 + 0: JS_IDENTIFIER_BINDING@528..529 + 0: IDENT@528..529 "x" [] [] + 1: TS_TYPE_ANNOTATION@529..545 + 0: COLON@529..531 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@531..545 + 0: TS_TYPE_PARAMETERS@531..537 + 0: L_ANGLE@531..532 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@532..536 + 0: TS_TYPE_PARAMETER@532..536 + 0: IN_KW@532..535 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@535..536 + 0: IDENT@535..536 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@536..537 ">" [] [] + 1: JS_PARAMETERS@537..540 + 0: L_PAREN@537..538 "(" [] [] + 1: JS_PARAMETER_LIST@538..538 + 2: R_PAREN@538..540 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@540..543 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@543..545 + 0: L_CURLY@543..544 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@544..544 + 2: R_CURLY@544..545 "}" [] [] + 2: (empty) + 1: SEMICOLON@545..546 ";" [] [] + 27: JS_VARIABLE_STATEMENT@546..570 + 0: JS_VARIABLE_DECLARATION@546..569 + 0: LET_KW@546..551 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@551..569 + 0: JS_VARIABLE_DECLARATOR@551..569 + 0: JS_IDENTIFIER_BINDING@551..552 + 0: IDENT@551..552 "x" [] [] + 1: TS_TYPE_ANNOTATION@552..569 + 0: COLON@552..554 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@554..569 + 0: TS_TYPE_PARAMETERS@554..561 + 0: L_ANGLE@554..555 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@555..560 + 0: TS_TYPE_PARAMETER@555..560 + 0: (empty) + 1: OUT_KW@555..559 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@559..560 + 0: IDENT@559..560 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@560..561 ">" [] [] + 1: JS_PARAMETERS@561..564 + 0: L_PAREN@561..562 "(" [] [] + 1: JS_PARAMETER_LIST@562..562 + 2: R_PAREN@562..564 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@564..567 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@567..569 + 0: L_CURLY@567..568 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@568..568 + 2: R_CURLY@568..569 "}" [] [] + 2: (empty) + 1: SEMICOLON@569..570 ";" [] [] + 28: JS_VARIABLE_STATEMENT@570..600 + 0: JS_VARIABLE_DECLARATION@570..599 + 0: LET_KW@570..575 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@575..599 + 0: JS_VARIABLE_DECLARATOR@575..599 + 0: JS_IDENTIFIER_BINDING@575..576 + 0: IDENT@575..576 "x" [] [] + 1: TS_TYPE_ANNOTATION@576..599 + 0: COLON@576..578 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@578..599 + 0: TS_TYPE_PARAMETERS@578..591 + 0: L_ANGLE@578..579 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@579..590 + 0: TS_TYPE_PARAMETER@579..583 + 0: IN_KW@579..582 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@582..583 + 0: IDENT@582..583 "T" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@583..585 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@585..590 + 0: (empty) + 1: OUT_KW@585..589 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@589..590 + 0: IDENT@589..590 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@590..591 ">" [] [] + 1: JS_PARAMETERS@591..594 + 0: L_PAREN@591..592 "(" [] [] + 1: JS_PARAMETER_LIST@592..592 + 2: R_PAREN@592..594 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@594..597 "=>" [] [Whitespace(" ")] + 3: TS_OBJECT_TYPE@597..599 + 0: L_CURLY@597..598 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@598..598 + 2: R_CURLY@598..599 "}" [] [] + 2: (empty) + 1: SEMICOLON@599..600 ";" [] [] + 29: JS_VARIABLE_STATEMENT@600..627 + 0: JS_VARIABLE_DECLARATION@600..626 + 0: LET_KW@600..605 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@605..626 + 0: JS_VARIABLE_DECLARATOR@605..626 + 0: JS_IDENTIFIER_BINDING@605..606 + 0: IDENT@605..606 "x" [] [] + 1: TS_TYPE_ANNOTATION@606..626 + 0: COLON@606..608 ":" [] [Whitespace(" ")] + 1: TS_CONSTRUCTOR_TYPE@608..626 + 0: (empty) + 1: NEW_KW@608..612 "new" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETERS@612..618 + 0: L_ANGLE@612..613 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@613..617 + 0: TS_TYPE_PARAMETER@613..617 + 0: IN_KW@613..616 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@616..617 + 0: IDENT@616..617 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@617..618 ">" [] [] + 3: JS_PARAMETERS@618..621 + 0: L_PAREN@618..619 "(" [] [] + 1: JS_PARAMETER_LIST@619..619 + 2: R_PAREN@619..621 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@621..624 "=>" [] [Whitespace(" ")] + 5: TS_OBJECT_TYPE@624..626 + 0: L_CURLY@624..625 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@625..625 + 2: R_CURLY@625..626 "}" [] [] + 2: (empty) + 1: SEMICOLON@626..627 ";" [] [] + 30: JS_VARIABLE_STATEMENT@627..655 + 0: JS_VARIABLE_DECLARATION@627..654 + 0: LET_KW@627..632 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@632..654 + 0: JS_VARIABLE_DECLARATOR@632..654 + 0: JS_IDENTIFIER_BINDING@632..633 + 0: IDENT@632..633 "x" [] [] + 1: TS_TYPE_ANNOTATION@633..654 + 0: COLON@633..635 ":" [] [Whitespace(" ")] + 1: TS_CONSTRUCTOR_TYPE@635..654 + 0: (empty) + 1: NEW_KW@635..639 "new" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETERS@639..646 + 0: L_ANGLE@639..640 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@640..645 + 0: TS_TYPE_PARAMETER@640..645 + 0: (empty) + 1: OUT_KW@640..644 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@644..645 + 0: IDENT@644..645 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@645..646 ">" [] [] + 3: JS_PARAMETERS@646..649 + 0: L_PAREN@646..647 "(" [] [] + 1: JS_PARAMETER_LIST@647..647 + 2: R_PAREN@647..649 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@649..652 "=>" [] [Whitespace(" ")] + 5: TS_OBJECT_TYPE@652..654 + 0: L_CURLY@652..653 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@653..653 + 2: R_CURLY@653..654 "}" [] [] + 2: (empty) + 1: SEMICOLON@654..655 ";" [] [] + 31: JS_VARIABLE_STATEMENT@655..689 + 0: JS_VARIABLE_DECLARATION@655..688 + 0: LET_KW@655..660 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@660..688 + 0: JS_VARIABLE_DECLARATOR@660..688 + 0: JS_IDENTIFIER_BINDING@660..661 + 0: IDENT@660..661 "x" [] [] + 1: TS_TYPE_ANNOTATION@661..688 + 0: COLON@661..663 ":" [] [Whitespace(" ")] + 1: TS_CONSTRUCTOR_TYPE@663..688 + 0: (empty) + 1: NEW_KW@663..667 "new" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETERS@667..680 + 0: L_ANGLE@667..668 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@668..679 + 0: TS_TYPE_PARAMETER@668..672 + 0: IN_KW@668..671 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@671..672 + 0: IDENT@671..672 "T" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@672..674 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@674..679 + 0: (empty) + 1: OUT_KW@674..678 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@678..679 + 0: IDENT@678..679 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@679..680 ">" [] [] + 3: JS_PARAMETERS@680..683 + 0: L_PAREN@680..681 "(" [] [] + 1: JS_PARAMETER_LIST@681..681 + 2: R_PAREN@681..683 ")" [] [Whitespace(" ")] + 4: FAT_ARROW@683..686 "=>" [] [Whitespace(" ")] + 5: TS_OBJECT_TYPE@686..688 + 0: L_CURLY@686..687 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@687..687 + 2: R_CURLY@687..688 "}" [] [] + 2: (empty) + 1: SEMICOLON@688..689 ";" [] [] + 32: JS_VARIABLE_STATEMENT@689..716 + 0: JS_VARIABLE_DECLARATION@689..715 + 0: LET_KW@689..694 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@694..715 + 0: JS_VARIABLE_DECLARATOR@694..715 + 0: JS_IDENTIFIER_BINDING@694..695 + 0: IDENT@694..695 "x" [] [] + 1: TS_TYPE_ANNOTATION@695..715 + 0: COLON@695..697 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@697..715 + 0: L_CURLY@697..699 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@699..714 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@699..714 + 0: JS_LITERAL_MEMBER_NAME@699..700 + 0: IDENT@699..700 "y" [] [] + 1: (empty) + 2: TS_TYPE_PARAMETERS@700..706 + 0: L_ANGLE@700..701 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@701..705 + 0: TS_TYPE_PARAMETER@701..705 + 0: IN_KW@701..704 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@704..705 + 0: IDENT@704..705 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@705..706 ">" [] [] + 3: JS_PARAMETERS@706..708 + 0: L_PAREN@706..707 "(" [] [] + 1: JS_PARAMETER_LIST@707..707 + 2: R_PAREN@707..708 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@708..714 + 0: COLON@708..710 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@710..714 + 0: ANY_KW@710..714 "any" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@714..715 "}" [] [] + 2: (empty) + 1: SEMICOLON@715..716 ";" [] [] + 33: JS_VARIABLE_STATEMENT@716..744 + 0: JS_VARIABLE_DECLARATION@716..743 + 0: LET_KW@716..721 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@721..743 + 0: JS_VARIABLE_DECLARATOR@721..743 + 0: JS_IDENTIFIER_BINDING@721..722 + 0: IDENT@721..722 "x" [] [] + 1: TS_TYPE_ANNOTATION@722..743 + 0: COLON@722..724 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@724..743 + 0: L_CURLY@724..726 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@726..742 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@726..742 + 0: JS_LITERAL_MEMBER_NAME@726..727 + 0: IDENT@726..727 "y" [] [] + 1: (empty) + 2: TS_TYPE_PARAMETERS@727..734 + 0: L_ANGLE@727..728 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@728..733 + 0: TS_TYPE_PARAMETER@728..733 + 0: (empty) + 1: OUT_KW@728..732 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@732..733 + 0: IDENT@732..733 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@733..734 ">" [] [] + 3: JS_PARAMETERS@734..736 + 0: L_PAREN@734..735 "(" [] [] + 1: JS_PARAMETER_LIST@735..735 + 2: R_PAREN@735..736 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@736..742 + 0: COLON@736..738 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@738..742 + 0: ANY_KW@738..742 "any" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@742..743 "}" [] [] + 2: (empty) + 1: SEMICOLON@743..744 ";" [] [] + 34: JS_VARIABLE_STATEMENT@744..778 + 0: JS_VARIABLE_DECLARATION@744..777 + 0: LET_KW@744..749 "let" [Newline("\n")] [Whitespace(" ")] + 1: JS_VARIABLE_DECLARATOR_LIST@749..777 + 0: JS_VARIABLE_DECLARATOR@749..777 + 0: JS_IDENTIFIER_BINDING@749..750 + 0: IDENT@749..750 "x" [] [] + 1: TS_TYPE_ANNOTATION@750..777 + 0: COLON@750..752 ":" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@752..777 + 0: L_CURLY@752..754 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@754..776 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@754..776 + 0: JS_LITERAL_MEMBER_NAME@754..755 + 0: IDENT@754..755 "y" [] [] + 1: (empty) + 2: TS_TYPE_PARAMETERS@755..768 + 0: L_ANGLE@755..756 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@756..767 + 0: TS_TYPE_PARAMETER@756..760 + 0: IN_KW@756..759 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@759..760 + 0: IDENT@759..760 "T" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@760..762 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@762..767 + 0: (empty) + 1: OUT_KW@762..766 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@766..767 + 0: IDENT@766..767 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@767..768 ">" [] [] + 3: JS_PARAMETERS@768..770 + 0: L_PAREN@768..769 "(" [] [] + 1: JS_PARAMETER_LIST@769..769 + 2: R_PAREN@769..770 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@770..776 + 0: COLON@770..772 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@772..776 + 0: ANY_KW@772..776 "any" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@776..777 "}" [] [] + 2: (empty) + 1: SEMICOLON@777..778 ";" [] [] + 3: EOF@778..779 "" [Newline("\n")] [] +-- +type_parameter_modifier1.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + > 1 │ export default function foo() {} + │ ^^ + 2 │ export function foo() {} + 3 │ export function foo1() {} + +-- +type_parameter_modifier1.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 1 │ export default function foo() {} + > 2 │ export function foo() {} + │ ^^^ + 3 │ export function foo1() {} + 4 │ export function foo2() {} + +-- +type_parameter_modifier1.ts:3:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 1 │ export default function foo() {} + 2 │ export function foo() {} + > 3 │ export function foo1() {} + │ ^^ + 4 │ export function foo2() {} + 5 │ let foo: Foo + +-- +type_parameter_modifier1.ts:4:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 2 │ export function foo() {} + 3 │ export function foo1() {} + > 4 │ export function foo2() {} + │ ^^^ + 5 │ let foo: Foo + 6 │ let foo: Foo + +-- +type_parameter_modifier1.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 3 │ export function foo1() {} + 4 │ export function foo2() {} + > 5 │ let foo: Foo + │ ^ + 6 │ let foo: Foo + 7 │ declare function foo() + + i Remove T + +-- +type_parameter_modifier1.ts:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 4 │ export function foo2() {} + 5 │ let foo: Foo + > 6 │ let foo: Foo + │ ^ + 7 │ declare function foo() + 8 │ declare function foo() + + i Remove T + +-- +type_parameter_modifier1.ts:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 5 │ let foo: Foo + 6 │ let foo: Foo + > 7 │ declare function foo() + │ ^^ + 8 │ declare function foo() + 9 │ declare let foo: Foo + +-- +type_parameter_modifier1.ts:8:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 6 │ let foo: Foo + 7 │ declare function foo() + > 8 │ declare function foo() + │ ^^^ + 9 │ declare let foo: Foo + 10 │ declare let foo: Foo + +-- +type_parameter_modifier1.ts:9:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 7 │ declare function foo() + 8 │ declare function foo() + > 9 │ declare let foo: Foo + │ ^ + 10 │ declare let foo: Foo + 11 │ foo = function () {} + + i Remove T + +-- +type_parameter_modifier1.ts:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `T` + + 8 │ declare function foo() + 9 │ declare let foo: Foo + > 10 │ declare let foo: Foo + │ ^ + 11 │ foo = function () {} + 12 │ foo = function () {} + + i Remove T + +-- +type_parameter_modifier1.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 9 │ declare let foo: Foo + 10 │ declare let foo: Foo + > 11 │ foo = function () {} + │ ^^ + 12 │ foo = function () {} + 13 │ class Foo { foo(): T {} } + +-- +type_parameter_modifier1.ts:12:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 10 │ declare let foo: Foo + 11 │ foo = function () {} + > 12 │ foo = function () {} + │ ^^^ + 13 │ class Foo { foo(): T {} } + 14 │ class Foo { foo(): T {} } + +-- +type_parameter_modifier1.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 11 │ foo = function () {} + 12 │ foo = function () {} + > 13 │ class Foo { foo(): T {} } + │ ^^ + 14 │ class Foo { foo(): T {} } + 15 │ foo = { foo(): T {} }; + +-- +type_parameter_modifier1.ts:14:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 12 │ foo = function () {} + 13 │ class Foo { foo(): T {} } + > 14 │ class Foo { foo(): T {} } + │ ^^^ + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + +-- +type_parameter_modifier1.ts:15:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 13 │ class Foo { foo(): T {} } + 14 │ class Foo { foo(): T {} } + > 15 │ foo = { foo(): T {} }; + │ ^^ + 16 │ foo = { foo(): T {} }; + 17 │ () => {}; + +-- +type_parameter_modifier1.ts:16:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 14 │ class Foo { foo(): T {} } + 15 │ foo = { foo(): T {} }; + > 16 │ foo = { foo(): T {} }; + │ ^^^ + 17 │ () => {}; + 18 │ () => {}; + +-- +type_parameter_modifier1.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `T` + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^ + 18 │ () => {}; + 19 │ () => {}; + + i Remove T + +-- +type_parameter_modifier1.ts:17:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parenthesized expression didnt contain anything + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^ + 18 │ () => {}; + 19 │ () => {}; + + i Expected an expression here + +-- +type_parameter_modifier1.ts:17:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^^ + 18 │ () => {}; + 19 │ () => {}; + + i An explicit or implicit semicolon is expected here... + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^^ + 18 │ () => {}; + 19 │ () => {}; + + i ...Which is required to end this statement + + 15 │ foo = { foo(): T {} }; + 16 │ foo = { foo(): T {} }; + > 17 │ () => {}; + │ ^^^^^^^^^^^ + 18 │ () => {}; + 19 │ () => {}; + +-- +type_parameter_modifier1.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 16 │ foo = { foo(): T {} }; + 17 │ () => {}; + > 18 │ () => {}; + │ ^^^ + 19 │ () => {}; + 20 │ let x: () => {}; + +-- +type_parameter_modifier1.ts:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `>` but instead found `T` + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i Remove T + +-- +type_parameter_modifier1.ts:19:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i An explicit or implicit semicolon is expected here... + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i ...Which is required to end this statement + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^^^^^^^^^^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + +-- +type_parameter_modifier1.ts:19:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Parenthesized expression didnt contain anything + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i Expected an expression here + +-- +type_parameter_modifier1.ts:19:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i An explicit or implicit semicolon is expected here... + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + + i ...Which is required to end this statement + + 17 │ () => {}; + 18 │ () => {}; + > 19 │ () => {}; + │ ^^^^^^^ + 20 │ let x: () => {}; + 21 │ let x: () => {}; + +-- +type_parameter_modifier1.ts:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 18 │ () => {}; + 19 │ () => {}; + > 20 │ let x: () => {}; + │ ^^ + 21 │ let x: () => {}; + 22 │ let x: () => {}; + +-- +type_parameter_modifier1.ts:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 19 │ () => {}; + 20 │ let x: () => {}; + > 21 │ let x: () => {}; + │ ^^^ + 22 │ let x: () => {}; + 23 │ let x: new () => {}; + +-- +type_parameter_modifier1.ts:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 20 │ let x: () => {}; + 21 │ let x: () => {}; + > 22 │ let x: () => {}; + │ ^^ + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + +-- +type_parameter_modifier1.ts:22:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 20 │ let x: () => {}; + 21 │ let x: () => {}; + > 22 │ let x: () => {}; + │ ^^^ + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + +-- +type_parameter_modifier1.ts:23:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 21 │ let x: () => {}; + 22 │ let x: () => {}; + > 23 │ let x: new () => {}; + │ ^^ + 24 │ let x: new () => {}; + 25 │ let x: new () => {}; + +-- +type_parameter_modifier1.ts:24:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 22 │ let x: () => {}; + 23 │ let x: new () => {}; + > 24 │ let x: new () => {}; + │ ^^^ + 25 │ let x: new () => {}; + 26 │ let x: { y(): any }; + +-- +type_parameter_modifier1.ts:25:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + > 25 │ let x: new () => {}; + │ ^^ + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + +-- +type_parameter_modifier1.ts:25:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 23 │ let x: new () => {}; + 24 │ let x: new () => {}; + > 25 │ let x: new () => {}; + │ ^^^ + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + +-- +type_parameter_modifier1.ts:26:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 24 │ let x: new () => {}; + 25 │ let x: new () => {}; + > 26 │ let x: { y(): any }; + │ ^^ + 27 │ let x: { y(): any }; + 28 │ let x: { y(): any }; + +-- +type_parameter_modifier1.ts:27:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 25 │ let x: new () => {}; + 26 │ let x: { y(): any }; + > 27 │ let x: { y(): any }; + │ ^^^ + 28 │ let x: { y(): any }; + 29 │ + +-- +type_parameter_modifier1.ts:28:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'in' modifier can only appear on a type parameter of a class, interface or type alias. + + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + > 28 │ let x: { y(): any }; + │ ^^ + 29 │ + +-- +type_parameter_modifier1.ts:28:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'out' modifier can only appear on a type parameter of a class, interface or type alias. + + 26 │ let x: { y(): any }; + 27 │ let x: { y(): any }; + > 28 │ let x: { y(): any }; + │ ^^^ + 29 │ + +-- +export default function foo() {} +export function foo() {} +export function foo1() {} +export function foo2() {} +let foo: Foo +let foo: Foo +declare function foo() +declare function foo() +declare let foo: Foo +declare let foo: Foo +foo = function () {} +foo = function () {} +class Foo { foo(): T {} } +class Foo { foo(): T {} } +foo = { foo(): T {} }; +foo = { foo(): T {} }; +() => {}; +() => {}; +() => {}; +let x: () => {}; +let x: () => {}; +let x: () => {}; +let x: new () => {}; +let x: new () => {}; +let x: new () => {}; +let x: { y(): any }; +let x: { y(): any }; +let x: { y(): any }; diff --git a/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.ts b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.ts new file mode 100644 index 00000000000..4a156c350cf --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/err/type_parameter_modifier1.ts @@ -0,0 +1,28 @@ +export default function foo() {} +export function foo() {} +export function foo1() {} +export function foo2() {} +let foo: Foo +let foo: Foo +declare function foo() +declare function foo() +declare let foo: Foo +declare let foo: Foo +foo = function () {} +foo = function () {} +class Foo { foo(): T {} } +class Foo { foo(): T {} } +foo = { foo(): T {} }; +foo = { foo(): T {} }; +() => {}; +() => {}; +() => {}; +let x: () => {}; +let x: () => {}; +let x: () => {}; +let x: new () => {}; +let x: new () => {}; +let x: new () => {}; +let x: { y(): any }; +let x: { y(): any }; +let x: { y(): any }; diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast b/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast index 4766714e0d1..4aac7578dd0 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast @@ -19,6 +19,8 @@ JsModule { l_angle_token: L_ANGLE@8..9 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@9..10 "A" [] [], }, @@ -27,6 +29,8 @@ JsModule { }, COMMA@10..12 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@12..14 "B" [] [Whitespace(" ")], }, @@ -43,6 +47,8 @@ JsModule { }, COMMA@23..25 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@25..27 "C" [] [Whitespace(" ")], }, @@ -142,6 +148,8 @@ JsModule { l_angle_token: L_ANGLE@81..82 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@82..83 "A" [] [], }, @@ -150,6 +158,8 @@ JsModule { }, COMMA@83..85 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@85..86 "B" [] [], }, @@ -250,27 +260,33 @@ JsModule { 0: L_ANGLE@8..9 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@9..35 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@10..12 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@12..23 - 0: TS_TYPE_PARAMETER_NAME@12..14 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@12..14 0: IDENT@12..14 "B" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@14..23 + 3: TS_TYPE_CONSTRAINT_CLAUSE@14..23 0: EXTENDS_KW@14..22 "extends" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@22..23 0: JS_REFERENCE_IDENTIFIER@22..23 0: IDENT@22..23 "A" [] [] 1: (empty) - 2: (empty) + 4: (empty) 3: COMMA@23..25 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@25..35 - 0: TS_TYPE_PARAMETER_NAME@25..27 - 0: IDENT@25..27 "C" [] [Whitespace(" ")] + 0: (empty) 1: (empty) - 2: TS_DEFAULT_TYPE_CLAUSE@27..35 + 2: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "C" [] [Whitespace(" ")] + 3: (empty) + 4: TS_DEFAULT_TYPE_CLAUSE@27..35 0: EQ@27..29 "=" [] [Whitespace(" ")] 1: TS_STRING_TYPE@29..35 0: STRING_KW@29..35 "string" [] [] @@ -335,16 +351,20 @@ JsModule { 0: L_ANGLE@81..82 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@82..86 0: TS_TYPE_PARAMETER@82..83 - 0: TS_TYPE_PARAMETER_NAME@82..83 - 0: IDENT@82..83 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@82..83 + 0: IDENT@82..83 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@83..85 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@85..86 - 0: TS_TYPE_PARAMETER_NAME@85..86 - 0: IDENT@85..86 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@85..86 + 0: IDENT@85..86 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@86..87 ">" [] [] 2: JS_PARAMETERS@87..99 0: L_PAREN@87..88 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast b/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast index a38cecaa99a..0d4854c70eb 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_as_assignment.rast @@ -31,6 +31,8 @@ JsModule { l_angle_token: L_ANGLE@18..19 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@19..20 "A" [] [], }, @@ -323,10 +325,12 @@ JsModule { 0: L_ANGLE@18..19 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@19..20 0: TS_TYPE_PARAMETER@19..20 - 0: TS_TYPE_PARAMETER_NAME@19..20 - 0: IDENT@19..20 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] 3: EQ@22..24 "=" [] [Whitespace(" ")] 4: TS_OBJECT_TYPE@24..32 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast b/crates/rome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast index c096a83e3a0..8017aa8d030 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast @@ -13,6 +13,8 @@ JsModule { l_angle_token: L_ANGLE@10..11 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@11..12 "A" [] [], }, @@ -21,6 +23,8 @@ JsModule { }, COMMA@12..14 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@14..15 "B" [] [], }, @@ -29,6 +33,8 @@ JsModule { }, COMMA@15..17 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@17..18 "C" [] [], }, @@ -235,6 +241,8 @@ JsModule { l_angle_token: L_ANGLE@94..95 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@95..96 "T" [] [], }, @@ -269,6 +277,8 @@ JsModule { l_angle_token: L_ANGLE@105..106 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@106..107 "T" [] [], }, @@ -342,22 +352,28 @@ JsModule { 0: L_ANGLE@10..11 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@11..18 0: TS_TYPE_PARAMETER@11..12 - 0: TS_TYPE_PARAMETER_NAME@11..12 - 0: IDENT@11..12 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@11..12 + 0: IDENT@11..12 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@12..14 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@14..15 - 0: TS_TYPE_PARAMETER_NAME@14..15 - 0: IDENT@14..15 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@14..15 + 0: IDENT@14..15 "B" [] [] + 3: (empty) + 4: (empty) 3: COMMA@15..17 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "C" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "C" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@18..19 ">" [] [] 5: JS_PARAMETERS@19..22 0: L_PAREN@19..20 "(" [] [] @@ -501,10 +517,12 @@ JsModule { 0: L_ANGLE@94..95 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@95..96 0: TS_TYPE_PARAMETER@95..96 - 0: TS_TYPE_PARAMETER_NAME@95..96 - 0: IDENT@95..96 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@95..96 + 0: IDENT@95..96 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@96..98 ">" [] [Whitespace(" ")] 3: EQ@98..100 "=" [] [Whitespace(" ")] 4: TS_REFERENCE_TYPE@100..101 @@ -526,10 +544,12 @@ JsModule { 0: L_ANGLE@105..106 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@106..107 0: TS_TYPE_PARAMETER@106..107 - 0: TS_TYPE_PARAMETER_NAME@106..107 - 0: IDENT@106..107 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@106..107 + 0: IDENT@106..107 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@107..108 ">" [] [] 1: JS_PARAMETERS@108..117 0: L_PAREN@108..109 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_call_signature_member.rast b/crates/rome_js_parser/test_data/inline/ok/ts_call_signature_member.rast index aea2964997f..3a3d11a6050 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_call_signature_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_call_signature_member.rast @@ -104,6 +104,8 @@ JsModule { l_angle_token: L_ANGLE@67..68 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@68..69 "A" [] [], }, @@ -112,6 +114,8 @@ JsModule { }, COMMA@69..71 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@71..72 "B" [] [], }, @@ -259,16 +263,20 @@ JsModule { 0: L_ANGLE@67..68 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@68..72 0: TS_TYPE_PARAMETER@68..69 - 0: TS_TYPE_PARAMETER_NAME@68..69 - 0: IDENT@68..69 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@68..69 + 0: IDENT@68..69 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@69..71 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@71..72 - 0: TS_TYPE_PARAMETER_NAME@71..72 - 0: IDENT@71..72 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@71..72 + 0: IDENT@71..72 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@72..73 ">" [] [] 1: JS_PARAMETERS@73..85 0: L_PAREN@73..74 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast b/crates/rome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast index a463965ef6b..d3d629f04bd 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast @@ -12,6 +12,8 @@ JsModule { l_angle_token: L_ANGLE@16..17 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@17..18 "A" [] [], }, @@ -20,6 +22,8 @@ JsModule { }, COMMA@18..20 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@20..21 "B" [] [], }, @@ -28,6 +32,8 @@ JsModule { }, COMMA@21..23 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@23..24 "C" [] [], }, @@ -60,22 +66,28 @@ JsModule { 0: L_ANGLE@16..17 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@17..24 0: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@18..20 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "B" [] [] + 3: (empty) + 4: (empty) 3: COMMA@21..23 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@23..24 - 0: TS_TYPE_PARAMETER_NAME@23..24 - 0: IDENT@23..24 "C" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@23..24 + 0: IDENT@23..24 "C" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@24..26 ">" [] [Whitespace(" ")] 4: (empty) 5: (empty) diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type.rast index 6da4e41e738..0e574dc540a 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type.rast @@ -102,6 +102,8 @@ JsModule { l_angle_token: L_ANGLE@141..142 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@142..143 "T" [] [], }, @@ -172,6 +174,8 @@ JsModule { l_angle_token: L_ANGLE@215..216 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@216..217 "U" [] [], }, @@ -180,6 +184,8 @@ JsModule { }, COMMA@217..219 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@219..220 "T" [] [], }, @@ -255,6 +261,8 @@ JsModule { l_angle_token: L_ANGLE@282..283 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@283..284 "T" [] [], }, @@ -345,6 +353,8 @@ JsModule { l_angle_token: L_ANGLE@360..361 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@361..362 "T" [] [], }, @@ -478,6 +488,8 @@ JsModule { l_angle_token: L_ANGLE@483..484 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@484..485 "T" [] [], }, @@ -634,10 +646,12 @@ JsModule { 0: L_ANGLE@141..142 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@142..143 0: TS_TYPE_PARAMETER@142..143 - 0: TS_TYPE_PARAMETER_NAME@142..143 - 0: IDENT@142..143 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@142..143 + 0: IDENT@142..143 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@143..145 ">" [] [Whitespace(" ")] 3: EQ@145..147 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@147..207 @@ -683,16 +697,20 @@ JsModule { 0: L_ANGLE@215..216 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@216..220 0: TS_TYPE_PARAMETER@216..217 - 0: TS_TYPE_PARAMETER_NAME@216..217 - 0: IDENT@216..217 "U" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@216..217 + 0: IDENT@216..217 "U" [] [] + 3: (empty) + 4: (empty) 1: COMMA@217..219 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@219..220 - 0: TS_TYPE_PARAMETER_NAME@219..220 - 0: IDENT@219..220 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@219..220 + 0: IDENT@219..220 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@220..222 ">" [] [Whitespace(" ")] 3: EQ@222..224 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@224..275 @@ -742,10 +760,12 @@ JsModule { 0: L_ANGLE@282..283 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@283..284 0: TS_TYPE_PARAMETER@283..284 - 0: TS_TYPE_PARAMETER_NAME@283..284 - 0: IDENT@283..284 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@283..284 + 0: IDENT@283..284 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@284..286 ">" [] [Whitespace(" ")] 3: EQ@286..288 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@288..352 @@ -809,10 +829,12 @@ JsModule { 0: L_ANGLE@360..361 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@361..362 0: TS_TYPE_PARAMETER@361..362 - 0: TS_TYPE_PARAMETER_NAME@361..362 - 0: IDENT@361..362 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@361..362 + 0: IDENT@361..362 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@362..364 ">" [] [Whitespace(" ")] 3: EQ@364..366 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@366..421 @@ -903,10 +925,12 @@ JsModule { 0: L_ANGLE@483..484 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@484..485 0: TS_TYPE_PARAMETER@484..485 - 0: TS_TYPE_PARAMETER_NAME@484..485 - 0: IDENT@484..485 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@484..485 + 0: IDENT@484..485 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@485..487 ">" [] [Whitespace(" ")] 3: EQ@487..489 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@489..552 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast b/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast index 913eeddc64e..a5769711633 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..8 "V" [] [], }, @@ -124,10 +126,12 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..8 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "V" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "V" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] 3: EQ@10..12 "=" [] [Whitespace(" ")] 4: TS_CONDITIONAL_TYPE@12..91 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast b/crates/rome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast index 40c8f51a633..fd886ed3ef3 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast @@ -103,6 +103,8 @@ JsModule { l_angle_token: L_ANGLE@84..85 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@85..86 "A" [] [], }, @@ -111,6 +113,8 @@ JsModule { }, COMMA@86..88 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@88..89 "B" [] [], }, @@ -257,16 +261,20 @@ JsModule { 0: L_ANGLE@84..85 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@85..89 0: TS_TYPE_PARAMETER@85..86 - 0: TS_TYPE_PARAMETER_NAME@85..86 - 0: IDENT@85..86 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@85..86 + 0: IDENT@85..86 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@86..88 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@88..89 - 0: TS_TYPE_PARAMETER_NAME@88..89 - 0: IDENT@88..89 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@88..89 + 0: IDENT@88..89 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@89..90 ">" [] [] 2: JS_PARAMETERS@90..102 0: L_PAREN@90..91 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_constructor_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_constructor_type.rast index fd741ad8483..0e20bf3e781 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_constructor_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_constructor_type.rast @@ -118,6 +118,8 @@ JsModule { l_angle_token: L_ANGLE@113..114 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@114..115 "A" [] [], }, @@ -126,6 +128,8 @@ JsModule { }, COMMA@115..117 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@117..118 "B" [] [], }, @@ -195,6 +199,8 @@ JsModule { l_angle_token: L_ANGLE@164..165 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@165..166 "A" [] [], }, @@ -203,6 +209,8 @@ JsModule { }, COMMA@166..168 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@168..169 "B" [] [], }, @@ -353,16 +361,20 @@ JsModule { 0: L_ANGLE@113..114 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@114..118 0: TS_TYPE_PARAMETER@114..115 - 0: TS_TYPE_PARAMETER_NAME@114..115 - 0: IDENT@114..115 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@114..115 + 0: IDENT@114..115 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@115..117 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@117..118 - 0: TS_TYPE_PARAMETER_NAME@117..118 - 0: IDENT@117..118 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@117..118 + 0: IDENT@117..118 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@118..119 ">" [] [] 3: JS_PARAMETERS@119..132 0: L_PAREN@119..120 "(" [] [] @@ -408,16 +420,20 @@ JsModule { 0: L_ANGLE@164..165 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@165..169 0: TS_TYPE_PARAMETER@165..166 - 0: TS_TYPE_PARAMETER_NAME@165..166 - 0: IDENT@165..166 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@165..166 + 0: IDENT@165..166 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@166..168 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@168..169 - 0: TS_TYPE_PARAMETER_NAME@168..169 - 0: IDENT@168..169 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@168..169 + 0: IDENT@168..169 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@169..170 ">" [] [] 3: JS_PARAMETERS@170..183 0: L_PAREN@170..171 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_declare_function.rast b/crates/rome_js_parser/test_data/inline/ok/ts_declare_function.rast index ef823c77d8f..c2ccb652579 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_declare_function.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_declare_function.rast @@ -14,6 +14,8 @@ JsModule { l_angle_token: L_ANGLE@21..22 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@22..23 "A" [] [], }, @@ -22,6 +24,8 @@ JsModule { }, COMMA@23..25 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@25..26 "B" [] [], }, @@ -30,6 +34,8 @@ JsModule { }, COMMA@26..28 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@28..29 "R" [] [], }, @@ -196,22 +202,28 @@ JsModule { 0: L_ANGLE@21..22 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@22..29 0: TS_TYPE_PARAMETER@22..23 - 0: TS_TYPE_PARAMETER_NAME@22..23 - 0: IDENT@22..23 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@22..23 + 0: IDENT@22..23 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@23..25 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@25..26 - 0: TS_TYPE_PARAMETER_NAME@25..26 - 0: IDENT@25..26 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@25..26 + 0: IDENT@25..26 "B" [] [] + 3: (empty) + 4: (empty) 3: COMMA@26..28 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@28..29 - 0: TS_TYPE_PARAMETER_NAME@28..29 - 0: IDENT@28..29 "R" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@28..29 + 0: IDENT@28..29 "R" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@29..30 ">" [] [] 4: JS_PARAMETERS@30..42 0: L_PAREN@30..31 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_default_type_clause.rast b/crates/rome_js_parser/test_data/inline/ok/ts_default_type_clause.rast index 0064e7fb5aa..52edabe9c46 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_default_type_clause.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_default_type_clause.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..8 "X" [] [], }, @@ -43,6 +45,8 @@ JsModule { l_angle_token: L_ANGLE@28..29 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@29..31 "X" [] [Whitespace(" ")], }, @@ -113,10 +117,12 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..15 0: TS_TYPE_PARAMETER@7..15 - 0: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "X" [] [] + 0: (empty) 1: (empty) - 2: TS_DEFAULT_TYPE_CLAUSE@8..15 + 2: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "X" [] [] + 3: (empty) + 4: TS_DEFAULT_TYPE_CLAUSE@8..15 0: EQ@8..9 "=" [] [] 1: TS_STRING_TYPE@9..15 0: STRING_KW@9..15 "string" [] [] @@ -135,9 +141,11 @@ JsModule { 0: L_ANGLE@28..29 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@29..63 0: TS_TYPE_PARAMETER@29..63 - 0: TS_TYPE_PARAMETER_NAME@29..31 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@29..31 0: IDENT@29..31 "X" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@31..55 + 3: TS_TYPE_CONSTRAINT_CLAUSE@31..55 0: EXTENDS_KW@31..39 "extends" [] [Whitespace(" ")] 1: TS_UNION_TYPE@39..55 0: (empty) @@ -147,7 +155,7 @@ JsModule { 1: PIPE@46..48 "|" [] [Whitespace(" ")] 2: TS_STRING_TYPE@48..55 0: STRING_KW@48..55 "string" [] [Whitespace(" ")] - 2: TS_DEFAULT_TYPE_CLAUSE@55..63 + 4: TS_DEFAULT_TYPE_CLAUSE@55..63 0: EQ@55..57 "=" [] [Whitespace(" ")] 1: TS_STRING_TYPE@57..63 0: STRING_KW@57..63 "string" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_function_statement.rast b/crates/rome_js_parser/test_data/inline/ok/ts_function_statement.rast index 5f431e8eb7d..e8b584e3f30 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_function_statement.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_function_statement.rast @@ -76,6 +76,8 @@ JsModule { l_angle_token: L_ANGLE@67..68 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@68..69 "A" [] [], }, @@ -84,6 +86,8 @@ JsModule { }, COMMA@69..71 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@71..73 "B" [] [Whitespace(" ")], }, @@ -100,6 +104,8 @@ JsModule { }, COMMA@82..84 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@84..86 "C" [] [Whitespace(" ")], }, @@ -245,27 +251,33 @@ JsModule { 0: L_ANGLE@67..68 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@68..89 0: TS_TYPE_PARAMETER@68..69 - 0: TS_TYPE_PARAMETER_NAME@68..69 - 0: IDENT@68..69 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@68..69 + 0: IDENT@68..69 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@69..71 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@71..82 - 0: TS_TYPE_PARAMETER_NAME@71..73 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@71..73 0: IDENT@71..73 "B" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@73..82 + 3: TS_TYPE_CONSTRAINT_CLAUSE@73..82 0: EXTENDS_KW@73..81 "extends" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@81..82 0: JS_REFERENCE_IDENTIFIER@81..82 0: IDENT@81..82 "A" [] [] 1: (empty) - 2: (empty) + 4: (empty) 3: COMMA@82..84 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@84..89 - 0: TS_TYPE_PARAMETER_NAME@84..86 - 0: IDENT@84..86 "C" [] [Whitespace(" ")] + 0: (empty) 1: (empty) - 2: TS_DEFAULT_TYPE_CLAUSE@86..89 + 2: TS_TYPE_PARAMETER_NAME@84..86 + 0: IDENT@84..86 "C" [] [Whitespace(" ")] + 3: (empty) + 4: TS_DEFAULT_TYPE_CLAUSE@86..89 0: EQ@86..88 "=" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@88..89 0: JS_REFERENCE_IDENTIFIER@88..89 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_function_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_function_type.rast index 2b9eadf0202..2aae28e6034 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_function_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_function_type.rast @@ -219,6 +219,8 @@ JsModule { l_angle_token: L_ANGLE@173..174 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@174..175 "A" [] [], }, @@ -227,6 +229,8 @@ JsModule { }, COMMA@175..177 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@177..178 "B" [] [], }, @@ -537,16 +541,20 @@ JsModule { 0: L_ANGLE@173..174 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@174..178 0: TS_TYPE_PARAMETER@174..175 - 0: TS_TYPE_PARAMETER_NAME@174..175 - 0: IDENT@174..175 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@174..175 + 0: IDENT@174..175 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@175..177 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@177..178 - 0: TS_TYPE_PARAMETER_NAME@177..178 - 0: IDENT@177..178 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@177..178 + 0: IDENT@177..178 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@178..179 ">" [] [] 1: JS_PARAMETERS@179..192 0: L_PAREN@179..180 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast index 14f0eab6d39..0e445ad7a75 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast @@ -781,6 +781,8 @@ JsModule { l_angle_token: L_ANGLE@516..517 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@517..518 "T" [] [], }, @@ -833,6 +835,8 @@ JsModule { l_angle_token: L_ANGLE@537..538 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@538..539 "T" [] [], }, @@ -1510,10 +1514,12 @@ JsModule { 0: L_ANGLE@516..517 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@517..518 0: TS_TYPE_PARAMETER@517..518 - 0: TS_TYPE_PARAMETER_NAME@517..518 - 0: IDENT@517..518 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@517..518 + 0: IDENT@517..518 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@518..519 ">" [] [] 1: JS_PARAMETERS@519..522 0: L_PAREN@519..520 "(" [] [] @@ -1546,10 +1552,12 @@ JsModule { 0: L_ANGLE@537..538 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@538..539 0: TS_TYPE_PARAMETER@538..539 - 0: TS_TYPE_PARAMETER_NAME@538..539 - 0: IDENT@538..539 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@538..539 + 0: IDENT@538..539 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@539..540 ">" [] [] 1: JS_PARAMETERS@540..543 0: L_PAREN@540..541 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast b/crates/rome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast index 5a9acd827db..8426b054153 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@11..12 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@12..16 "Prop" [] [], }, @@ -124,10 +126,12 @@ JsModule { 0: L_ANGLE@11..12 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@12..16 0: TS_TYPE_PARAMETER@12..16 - 0: TS_TYPE_PARAMETER_NAME@12..16 - 0: IDENT@12..16 "Prop" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@12..16 + 0: IDENT@12..16 "Prop" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@16..18 ">" [] [Whitespace(" ")] 3: (empty) 4: L_CURLY@18..20 "{" [] [Whitespace(" ")] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_mapped_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_mapped_type.rast index 1087db47ddd..b0ece9bf398 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_mapped_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_mapped_type.rast @@ -47,6 +47,8 @@ JsModule { l_angle_token: L_ANGLE@50..51 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@51..55 "Type" [] [], }, @@ -97,6 +99,8 @@ JsModule { l_angle_token: L_ANGLE@119..120 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@120..124 "Type" [] [], }, @@ -163,6 +167,8 @@ JsModule { l_angle_token: L_ANGLE@199..200 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@200..204 "Type" [] [], }, @@ -229,6 +235,8 @@ JsModule { l_angle_token: L_ANGLE@270..271 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@271..275 "Type" [] [], }, @@ -377,10 +385,12 @@ JsModule { 0: L_ANGLE@50..51 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@51..55 0: TS_TYPE_PARAMETER@51..55 - 0: TS_TYPE_PARAMETER_NAME@51..55 - 0: IDENT@51..55 "Type" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@51..55 + 0: IDENT@51..55 "Type" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@55..57 ">" [] [Whitespace(" ")] 3: EQ@57..59 "=" [] [Whitespace(" ")] 4: TS_MAPPED_TYPE@59..99 @@ -414,10 +424,12 @@ JsModule { 0: L_ANGLE@119..120 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@120..124 0: TS_TYPE_PARAMETER@120..124 - 0: TS_TYPE_PARAMETER_NAME@120..124 - 0: IDENT@120..124 "Type" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@120..124 + 0: IDENT@120..124 "Type" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] 3: EQ@126..128 "=" [] [Whitespace(" ")] 4: TS_MAPPED_TYPE@128..184 @@ -462,10 +474,12 @@ JsModule { 0: L_ANGLE@199..200 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@200..204 0: TS_TYPE_PARAMETER@200..204 - 0: TS_TYPE_PARAMETER_NAME@200..204 - 0: IDENT@200..204 "Type" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@200..204 + 0: IDENT@200..204 "Type" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@204..206 ">" [] [Whitespace(" ")] 3: EQ@206..208 "=" [] [Whitespace(" ")] 4: TS_MAPPED_TYPE@208..256 @@ -510,10 +524,12 @@ JsModule { 0: L_ANGLE@270..271 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@271..275 0: TS_TYPE_PARAMETER@271..275 - 0: TS_TYPE_PARAMETER_NAME@271..275 - 0: IDENT@271..275 "Type" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@271..275 + 0: IDENT@271..275 "Type" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@275..277 ">" [] [Whitespace(" ")] 3: EQ@277..279 "=" [] [Whitespace(" ")] 4: TS_MAPPED_TYPE@279..374 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_method_class_member.rast b/crates/rome_js_parser/test_data/inline/ok/ts_method_class_member.rast index e1cb9b64d2d..ab28c588d62 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_method_class_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_method_class_member.rast @@ -25,6 +25,8 @@ JsModule { l_angle_token: L_ANGLE@19..20 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@20..21 "A" [] [], }, @@ -33,6 +35,8 @@ JsModule { }, COMMA@21..23 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@23..25 "B" [] [Whitespace(" ")], }, @@ -49,6 +53,8 @@ JsModule { }, COMMA@34..36 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@36..37 "R" [] [], }, @@ -145,27 +151,33 @@ JsModule { 0: L_ANGLE@19..20 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@20..37 0: TS_TYPE_PARAMETER@20..21 - 0: TS_TYPE_PARAMETER_NAME@20..21 - 0: IDENT@20..21 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@20..21 + 0: IDENT@20..21 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@21..23 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@23..34 - 0: TS_TYPE_PARAMETER_NAME@23..25 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@23..25 0: IDENT@23..25 "B" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@25..34 + 3: TS_TYPE_CONSTRAINT_CLAUSE@25..34 0: EXTENDS_KW@25..33 "extends" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@33..34 0: JS_REFERENCE_IDENTIFIER@33..34 0: IDENT@33..34 "A" [] [] 1: (empty) - 2: (empty) + 4: (empty) 3: COMMA@34..36 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@36..37 - 0: TS_TYPE_PARAMETER_NAME@36..37 - 0: IDENT@36..37 "R" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@36..37 + 0: IDENT@36..37 "R" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@37..38 ">" [] [] 6: JS_PARAMETERS@38..50 0: L_PAREN@38..39 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast b/crates/rome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast index 40125384ad0..b49259c1080 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast @@ -18,6 +18,8 @@ JsModule { l_angle_token: L_ANGLE@8..9 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@9..10 "A" [] [], }, @@ -135,6 +137,8 @@ JsModule { l_angle_token: L_ANGLE@115..116 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@116..117 "R" [] [], }, @@ -253,10 +257,12 @@ JsModule { 0: L_ANGLE@8..9 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@9..10 0: TS_TYPE_PARAMETER@9..10 - 0: TS_TYPE_PARAMETER_NAME@9..10 - 0: IDENT@9..10 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@9..10 + 0: IDENT@9..10 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@10..11 ">" [] [] 4: JS_PARAMETERS@11..24 0: L_PAREN@11..12 "(" [] [] @@ -335,10 +341,12 @@ JsModule { 0: L_ANGLE@115..116 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@116..117 0: TS_TYPE_PARAMETER@116..117 - 0: TS_TYPE_PARAMETER_NAME@116..117 - 0: IDENT@116..117 "R" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@116..117 + 0: IDENT@116..117 "R" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@117..118 ">" [] [] 4: JS_PARAMETERS@118..137 0: L_PAREN@118..119 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast b/crates/rome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast index 553b15e03f1..4d2a7714c3c 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast @@ -12,6 +12,8 @@ JsModule { l_angle_token: L_ANGLE@10..11 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@11..12 "A" [] [], }, @@ -20,6 +22,8 @@ JsModule { }, COMMA@12..14 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@14..15 "B" [] [], }, @@ -28,6 +32,8 @@ JsModule { }, COMMA@15..17 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@17..18 "C" [] [], }, @@ -102,22 +108,28 @@ JsModule { 0: L_ANGLE@10..11 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@11..18 0: TS_TYPE_PARAMETER@11..12 - 0: TS_TYPE_PARAMETER_NAME@11..12 - 0: IDENT@11..12 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@11..12 + 0: IDENT@11..12 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@12..14 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@14..15 - 0: TS_TYPE_PARAMETER_NAME@14..15 - 0: IDENT@14..15 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@14..15 + 0: IDENT@14..15 "B" [] [] + 3: (empty) + 4: (empty) 3: COMMA@15..17 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@17..18 - 0: TS_TYPE_PARAMETER_NAME@17..18 - 0: IDENT@17..18 "C" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@17..18 + 0: IDENT@17..18 "C" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@18..20 ">" [] [Whitespace(" ")] 4: (empty) 5: (empty) diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast b/crates/rome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast index c2955b49372..d8e9734cc86 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast @@ -12,6 +12,8 @@ JsModule { l_angle_token: L_ANGLE@1..2 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@2..3 "A" [] [], }, @@ -20,6 +22,8 @@ JsModule { }, COMMA@3..5 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@5..6 "B" [] [], }, @@ -91,16 +95,20 @@ JsModule { 0: L_ANGLE@1..2 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@2..6 0: TS_TYPE_PARAMETER@2..3 - 0: TS_TYPE_PARAMETER_NAME@2..3 - 0: IDENT@2..3 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@2..3 + 0: IDENT@2..3 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@3..5 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@5..6 - 0: TS_TYPE_PARAMETER_NAME@5..6 - 0: IDENT@5..6 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@5..6 + 0: IDENT@5..6 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@6..7 ">" [] [] 2: JS_PARAMETERS@7..10 0: L_PAREN@7..8 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast b/crates/rome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast index a99e3b39611..c612a50996c 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast @@ -236,6 +236,8 @@ JsModule { l_angle_token: L_ANGLE@189..190 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@190..191 "A" [] [], }, @@ -244,6 +246,8 @@ JsModule { }, COMMA@191..193 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@193..194 "B" [] [], }, @@ -485,16 +489,20 @@ JsModule { 0: L_ANGLE@189..190 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@190..194 0: TS_TYPE_PARAMETER@190..191 - 0: TS_TYPE_PARAMETER_NAME@190..191 - 0: IDENT@190..191 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@190..191 + 0: IDENT@190..191 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@191..193 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@193..194 - 0: TS_TYPE_PARAMETER_NAME@193..194 - 0: IDENT@193..194 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@193..194 + 0: IDENT@193..194 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@194..195 ">" [] [] 3: JS_PARAMETERS@195..207 0: L_PAREN@195..196 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast index 91212795474..28e4e2a95e7 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast @@ -31,6 +31,8 @@ JsModule { l_angle_token: L_ANGLE@18..19 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@19..20 "A" [] [], }, @@ -300,10 +302,12 @@ JsModule { 0: L_ANGLE@18..19 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@19..20 0: TS_TYPE_PARAMETER@19..20 - 0: TS_TYPE_PARAMETER_NAME@19..20 - 0: IDENT@19..20 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "A" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] 3: EQ@22..24 "=" [] [Whitespace(" ")] 4: TS_OBJECT_TYPE@24..32 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_template_literal_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_template_literal_type.rast index ca002c0ad6c..cad3b03e23e 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_template_literal_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_template_literal_type.rast @@ -57,6 +57,8 @@ JsModule { l_angle_token: L_ANGLE@39..40 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@40..42 "X" [] [Whitespace(" ")], }, @@ -142,13 +144,15 @@ JsModule { 0: L_ANGLE@39..40 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@40..56 0: TS_TYPE_PARAMETER@40..56 - 0: TS_TYPE_PARAMETER_NAME@40..42 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@40..42 0: IDENT@40..42 "X" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@42..56 + 3: TS_TYPE_CONSTRAINT_CLAUSE@42..56 0: EXTENDS_KW@42..50 "extends" [] [Whitespace(" ")] 1: TS_STRING_TYPE@50..56 0: STRING_KW@50..56 "string" [] [] - 2: (empty) + 4: (empty) 2: R_ANGLE@56..58 ">" [] [Whitespace(" ")] 3: EQ@58..60 "=" [] [Whitespace(" ")] 4: TS_TEMPLATE_LITERAL_TYPE@60..67 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast index b75828febe2..0913f8784a0 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..8 "T" [] [], }, @@ -48,6 +50,8 @@ JsModule { l_angle_token: L_ANGLE@26..27 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@27..28 "C" [] [], }, @@ -106,10 +110,12 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..8 0: TS_TYPE_PARAMETER@7..8 - 0: TS_TYPE_PARAMETER_NAME@7..8 - 0: IDENT@7..8 "T" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@7..8 + 0: IDENT@7..8 "T" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@8..10 ">" [] [Whitespace(" ")] 3: EQ@10..12 "=" [] [Whitespace(" ")] 4: TS_REFERENCE_TYPE@12..13 @@ -134,10 +140,12 @@ JsModule { 0: L_ANGLE@26..27 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@27..28 0: TS_TYPE_PARAMETER@27..28 - 0: TS_TYPE_PARAMETER_NAME@27..28 - 0: IDENT@27..28 "C" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@27..28 + 0: IDENT@27..28 "C" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@28..29 ">" [] [] 1: JS_PARAMETERS@29..36 0: L_PAREN@29..30 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast index ba49e5afc91..61d1072f793 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], }, @@ -43,6 +45,8 @@ JsModule { l_angle_token: L_ANGLE@36..37 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@37..39 "X" [] [Whitespace(" ")], }, @@ -108,13 +112,15 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..23 0: TS_TYPE_PARAMETER@7..23 - 0: TS_TYPE_PARAMETER_NAME@7..9 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@7..9 0: IDENT@7..9 "X" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@9..23 + 3: TS_TYPE_CONSTRAINT_CLAUSE@9..23 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] 1: TS_NUMBER_TYPE@17..23 0: NUMBER_KW@17..23 "number" [] [] - 2: (empty) + 4: (empty) 2: R_ANGLE@23..25 ">" [] [Whitespace(" ")] 3: EQ@25..27 "=" [] [Whitespace(" ")] 4: TS_REFERENCE_TYPE@27..28 @@ -130,9 +136,11 @@ JsModule { 0: L_ANGLE@36..37 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@37..62 0: TS_TYPE_PARAMETER@37..62 - 0: TS_TYPE_PARAMETER_NAME@37..39 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@37..39 0: IDENT@37..39 "X" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@39..62 + 3: TS_TYPE_CONSTRAINT_CLAUSE@39..62 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] 1: TS_UNION_TYPE@47..62 0: (empty) @@ -142,7 +150,7 @@ JsModule { 1: PIPE@54..56 "|" [] [Whitespace(" ")] 2: TS_STRING_TYPE@56..62 0: STRING_KW@56..62 "string" [] [] - 2: (empty) + 4: (empty) 2: R_ANGLE@62..64 ">" [] [Whitespace(" ")] 3: EQ@64..66 "=" [] [Whitespace(" ")] 4: TS_OBJECT_TYPE@66..74 diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_type_parameters.rast b/crates/rome_js_parser/test_data/inline/ok/ts_type_parameters.rast index de569ab355b..0bb2b71ddf2 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_type_parameters.rast @@ -11,6 +11,8 @@ JsModule { l_angle_token: L_ANGLE@6..7 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@7..9 "X" [] [Whitespace(" ")], }, @@ -24,6 +26,8 @@ JsModule { }, COMMA@23..25 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@25..27 "Y" [] [Whitespace(" ")], }, @@ -37,6 +41,8 @@ JsModule { }, COMMA@35..37 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@37..39 "Z" [] [Whitespace(" ")], }, @@ -141,27 +147,33 @@ JsModule { 0: L_ANGLE@6..7 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@7..71 0: TS_TYPE_PARAMETER@7..23 - 0: TS_TYPE_PARAMETER_NAME@7..9 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@7..9 0: IDENT@7..9 "X" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@9..23 + 3: TS_TYPE_CONSTRAINT_CLAUSE@9..23 0: EXTENDS_KW@9..17 "extends" [] [Whitespace(" ")] 1: TS_STRING_TYPE@17..23 0: STRING_KW@17..23 "string" [] [] - 2: (empty) + 4: (empty) 1: COMMA@23..25 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@25..35 - 0: TS_TYPE_PARAMETER_NAME@25..27 - 0: IDENT@25..27 "Y" [] [Whitespace(" ")] + 0: (empty) 1: (empty) - 2: TS_DEFAULT_TYPE_CLAUSE@27..35 + 2: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "Y" [] [Whitespace(" ")] + 3: (empty) + 4: TS_DEFAULT_TYPE_CLAUSE@27..35 0: EQ@27..29 "=" [] [Whitespace(" ")] 1: TS_NUMBER_TYPE@29..35 0: NUMBER_KW@29..35 "number" [] [] 3: COMMA@35..37 "," [] [Whitespace(" ")] 4: TS_TYPE_PARAMETER@37..71 - 0: TS_TYPE_PARAMETER_NAME@37..39 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@37..39 0: IDENT@37..39 "Z" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@39..63 + 3: TS_TYPE_CONSTRAINT_CLAUSE@39..63 0: EXTENDS_KW@39..47 "extends" [] [Whitespace(" ")] 1: TS_UNION_TYPE@47..63 0: (empty) @@ -171,7 +183,7 @@ JsModule { 1: PIPE@54..56 "|" [] [Whitespace(" ")] 2: TS_NUMBER_TYPE@56..63 0: NUMBER_KW@56..63 "number" [] [Whitespace(" ")] - 2: TS_DEFAULT_TYPE_CLAUSE@63..71 + 4: TS_DEFAULT_TYPE_CLAUSE@63..71 0: EQ@63..65 "=" [] [Whitespace(" ")] 1: TS_NUMBER_TYPE@65..71 0: NUMBER_KW@65..71 "number" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast b/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast index 0ce8fcc79c2..f4a002f9a9b 100644 --- a/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast +++ b/crates/rome_js_parser/test_data/inline/ok/ts_typeof_type.rast @@ -71,6 +71,8 @@ JsModule { l_angle_token: L_ANGLE@74..75 "<" [] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@75..76 "U" [] [], }, @@ -170,10 +172,12 @@ JsModule { 0: L_ANGLE@74..75 "<" [] [] 1: TS_TYPE_PARAMETER_LIST@75..76 0: TS_TYPE_PARAMETER@75..76 - 0: TS_TYPE_PARAMETER_NAME@75..76 - 0: IDENT@75..76 "U" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@75..76 + 0: IDENT@75..76 "U" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@76..78 ">" [] [Whitespace(" ")] 3: EQ@78..80 "=" [] [Whitespace(" ")] 4: TS_REFERENCE_TYPE@80..109 diff --git a/crates/rome_js_parser/test_data/inline/ok/tsx_type_arguments.rast b/crates/rome_js_parser/test_data/inline/ok/tsx_type_arguments.rast index 2e403f071e3..99c32e6bb39 100644 --- a/crates/rome_js_parser/test_data/inline/ok/tsx_type_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/ok/tsx_type_arguments.rast @@ -9,6 +9,8 @@ JsModule { l_angle_token: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@35..37 "A" [] [Whitespace(" ")], }, @@ -49,6 +51,8 @@ JsModule { l_angle_token: L_ANGLE@56..58 "<" [Newline("\n")] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@58..59 "A" [] [], }, @@ -86,6 +90,8 @@ JsModule { l_angle_token: L_ANGLE@76..78 "<" [Newline("\n")] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@78..79 "A" [] [], }, @@ -94,6 +100,8 @@ JsModule { }, COMMA@79..81 "," [] [Whitespace(" ")], TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@81..82 "B" [] [], }, @@ -126,6 +134,8 @@ JsModule { l_angle_token: L_ANGLE@92..94 "<" [Newline("\n")] [], items: TsTypeParameterList [ TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), name: TsTypeParameterName { ident_token: IDENT@94..96 "A" [] [Whitespace(" ")], }, @@ -185,15 +195,17 @@ JsModule { 0: L_ANGLE@0..35 "<" [Comments("// These are valid ty ..."), Newline("\n")] [] 1: TS_TYPE_PARAMETER_LIST@35..46 0: TS_TYPE_PARAMETER@35..46 - 0: TS_TYPE_PARAMETER_NAME@35..37 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@35..37 0: IDENT@35..37 "A" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@37..46 + 3: TS_TYPE_CONSTRAINT_CLAUSE@37..46 0: EXTENDS_KW@37..45 "extends" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@45..46 0: JS_REFERENCE_IDENTIFIER@45..46 0: IDENT@45..46 "B" [] [] 1: (empty) - 2: (empty) + 4: (empty) 2: R_ANGLE@46..47 ">" [] [] 2: JS_PARAMETERS@47..50 0: L_PAREN@47..48 "(" [] [] @@ -214,10 +226,12 @@ JsModule { 0: L_ANGLE@56..58 "<" [Newline("\n")] [] 1: TS_TYPE_PARAMETER_LIST@58..66 0: TS_TYPE_PARAMETER@58..66 - 0: TS_TYPE_PARAMETER_NAME@58..59 - 0: IDENT@58..59 "A" [] [] + 0: (empty) 1: (empty) - 2: TS_DEFAULT_TYPE_CLAUSE@59..66 + 2: TS_TYPE_PARAMETER_NAME@58..59 + 0: IDENT@58..59 "A" [] [] + 3: (empty) + 4: TS_DEFAULT_TYPE_CLAUSE@59..66 0: EQ@59..60 "=" [] [] 1: TS_STRING_TYPE@60..66 0: STRING_KW@60..66 "string" [] [] @@ -241,16 +255,20 @@ JsModule { 0: L_ANGLE@76..78 "<" [Newline("\n")] [] 1: TS_TYPE_PARAMETER_LIST@78..82 0: TS_TYPE_PARAMETER@78..79 - 0: TS_TYPE_PARAMETER_NAME@78..79 - 0: IDENT@78..79 "A" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@78..79 + 0: IDENT@78..79 "A" [] [] + 3: (empty) + 4: (empty) 1: COMMA@79..81 "," [] [Whitespace(" ")] 2: TS_TYPE_PARAMETER@81..82 - 0: TS_TYPE_PARAMETER_NAME@81..82 - 0: IDENT@81..82 "B" [] [] + 0: (empty) 1: (empty) - 2: (empty) + 2: TS_TYPE_PARAMETER_NAME@81..82 + 0: IDENT@81..82 "B" [] [] + 3: (empty) + 4: (empty) 2: R_ANGLE@82..83 ">" [] [] 2: JS_PARAMETERS@83..86 0: L_PAREN@83..84 "(" [] [] @@ -271,9 +289,11 @@ JsModule { 0: L_ANGLE@92..94 "<" [Newline("\n")] [] 1: TS_TYPE_PARAMETER_LIST@94..108 0: TS_TYPE_PARAMETER@94..108 - 0: TS_TYPE_PARAMETER_NAME@94..96 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@94..96 0: IDENT@94..96 "A" [] [Whitespace(" ")] - 1: TS_TYPE_CONSTRAINT_CLAUSE@96..108 + 3: TS_TYPE_CONSTRAINT_CLAUSE@96..108 0: EXTENDS_KW@96..104 "extends" [] [Whitespace(" ")] 1: TS_REFERENCE_TYPE@104..108 0: JS_REFERENCE_IDENTIFIER@104..105 @@ -286,7 +306,7 @@ JsModule { 0: IDENT@106..107 "C" [] [] 1: (empty) 2: R_ANGLE@107..108 ">" [] [] - 2: (empty) + 4: (empty) 2: R_ANGLE@108..109 ">" [] [] 2: JS_PARAMETERS@109..112 0: L_PAREN@109..110 "(" [] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast new file mode 100644 index 00000000000..55d8a74c891 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.rast @@ -0,0 +1,1022 @@ +JsModule { + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + TsTypeAliasDeclaration { + type_token: TYPE_KW@0..5 "type" [] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@5..8 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@8..9 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@9..12 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@12..13 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@13..15 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@15..17 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@17..18 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@18..19 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@25..28 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@28..29 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@29..32 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@32..34 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@34..36 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@36..37 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@37..38 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@44..47 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@47..48 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@48..52 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@52..53 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@53..55 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@55..57 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@57..58 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@58..59 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@65..68 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@68..69 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@69..72 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@72..75 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@75..77 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@77..79 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@79..80 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@80..81 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@87..90 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@90..91 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@91..95 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@95..98 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@98..100 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@100..102 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@102..103 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@103..104 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@110..113 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@113..114 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@114..117 "in" [] [Whitespace(" ")], + out_modifier_token: OUT_KW@117..121 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@121..124 "out" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@124..126 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@126..128 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@128..129 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@129..130 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@136..139 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@139..140 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@140..143 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@143..144 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@144..146 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@146..150 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@150..151 "Y" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@151..153 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@153..155 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@155..156 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@156..157 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@163..166 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@166..167 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@167..171 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@171..172 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@172..174 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: IN_KW@174..177 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@177..178 "Y" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@178..180 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@180..182 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@182..183 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@183..184 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@190..193 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@193..194 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@194..198 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@198..199 "X" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + COMMA@199..201 "," [] [Whitespace(" ")], + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@201..205 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@205..207 "Y" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@221..222 "X" [] [], + }, + type_arguments: missing (optional), + }, + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@222..224 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@224..226 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@226..227 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@227..228 "}" [] [], + }, + semicolon_token: missing (optional), + }, + JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@235..238 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@238..239 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@239..242 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@242..243 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@243..245 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@245..246 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@246..247 "}" [] [], + }, + JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@254..257 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@257..258 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@258..262 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@262..263 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@263..265 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@265..266 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@266..267 "}" [] [], + }, + JsExport { + export_token: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")], + export_clause: JsExportDefaultDeclarationClause { + default_token: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")], + declaration: JsClassExportDefaultDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@283..289 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@289..292 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@292..293 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@293..296 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@296..297 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@297..299 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@299..300 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@300..301 "}" [] [], + }, + semicolon_token: missing (optional), + }, + }, + JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@308..311 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@311..312 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@312..316 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@316..317 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@317..319 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@319..320 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@320..321 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@332..335 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@335..336 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@336..339 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@339..340 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@340..342 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@342..343 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@343..344 "}" [] [], + }, + TsInterfaceDeclaration { + interface_token: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@355..358 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@358..359 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@359..363 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@363..364 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@364..366 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@366..367 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@367..368 "}" [] [], + }, + TsDeclareStatement { + declare_token: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@377..383 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@383..386 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@386..387 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@387..390 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@390..391 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@391..393 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@393..394 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@394..395 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: JsClassDeclaration { + abstract_token: missing (optional), + class_token: CLASS_KW@404..410 "class" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@410..413 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@413..414 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@414..418 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@418..419 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@419..421 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@421..422 "{" [] [], + members: JsClassMemberList [], + r_curly_token: R_CURLY@422..423 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@442..445 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@445..446 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: IN_KW@446..449 "in" [] [Whitespace(" ")], + out_modifier_token: missing (optional), + name: TsTypeParameterName { + ident_token: IDENT@449..450 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@450..452 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@452..453 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@453..454 "}" [] [], + }, + }, + TsDeclareStatement { + declare_token: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")], + declaration: TsInterfaceDeclaration { + interface_token: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")], + id: TsIdentifierBinding { + name_token: IDENT@473..476 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@476..477 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + in_modifier_token: missing (optional), + out_modifier_token: OUT_KW@477..481 "out" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@481..482 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@482..484 ">" [] [Whitespace(" ")], + }, + extends_clause: missing (optional), + l_curly_token: L_CURLY@484..485 "{" [] [], + members: TsTypeMemberList [], + r_curly_token: R_CURLY@485..486 "}" [] [], + }, + }, + ], + eof_token: EOF@486..487 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..487 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..486 + 0: TS_TYPE_ALIAS_DECLARATION@0..19 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..8 + 0: IDENT@5..8 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@8..15 + 0: L_ANGLE@8..9 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@9..13 + 0: TS_TYPE_PARAMETER@9..13 + 0: IN_KW@9..12 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@12..13 + 0: IDENT@12..13 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@13..15 ">" [] [Whitespace(" ")] + 3: EQ@15..17 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@17..19 + 0: L_CURLY@17..18 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@18..18 + 2: R_CURLY@18..19 "}" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@19..38 + 0: TYPE_KW@19..25 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@25..28 + 0: IDENT@25..28 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@28..34 + 0: L_ANGLE@28..29 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@29..32 + 0: TS_TYPE_PARAMETER@29..32 + 0: (empty) + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@29..32 + 0: IDENT@29..32 "out" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@32..34 ">" [] [Whitespace(" ")] + 3: EQ@34..36 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@36..38 + 0: L_CURLY@36..37 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@37..37 + 2: R_CURLY@37..38 "}" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@38..59 + 0: TYPE_KW@38..44 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@44..47 + 0: IDENT@44..47 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@47..55 + 0: L_ANGLE@47..48 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@48..53 + 0: TS_TYPE_PARAMETER@48..53 + 0: (empty) + 1: OUT_KW@48..52 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@52..53 + 0: IDENT@52..53 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@53..55 ">" [] [Whitespace(" ")] + 3: EQ@55..57 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@57..59 + 0: L_CURLY@57..58 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@58..58 + 2: R_CURLY@58..59 "}" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@59..81 + 0: TYPE_KW@59..65 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@65..68 + 0: IDENT@65..68 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@68..77 + 0: L_ANGLE@68..69 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@69..75 + 0: TS_TYPE_PARAMETER@69..75 + 0: IN_KW@69..72 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@72..75 + 0: IDENT@72..75 "out" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@75..77 ">" [] [Whitespace(" ")] + 3: EQ@77..79 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@79..81 + 0: L_CURLY@79..80 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@80..80 + 2: R_CURLY@80..81 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@81..104 + 0: TYPE_KW@81..87 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@87..90 + 0: IDENT@87..90 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@90..100 + 0: L_ANGLE@90..91 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@91..98 + 0: TS_TYPE_PARAMETER@91..98 + 0: (empty) + 1: OUT_KW@91..95 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@95..98 + 0: IDENT@95..98 "out" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@98..100 ">" [] [Whitespace(" ")] + 3: EQ@100..102 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@102..104 + 0: L_CURLY@102..103 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@103..103 + 2: R_CURLY@103..104 "}" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@104..130 + 0: TYPE_KW@104..110 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@110..113 + 0: IDENT@110..113 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@113..126 + 0: L_ANGLE@113..114 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@114..124 + 0: TS_TYPE_PARAMETER@114..124 + 0: IN_KW@114..117 "in" [] [Whitespace(" ")] + 1: OUT_KW@117..121 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@121..124 + 0: IDENT@121..124 "out" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@124..126 ">" [] [Whitespace(" ")] + 3: EQ@126..128 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@128..130 + 0: L_CURLY@128..129 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@129..129 + 2: R_CURLY@129..130 "}" [] [] + 5: (empty) + 6: TS_TYPE_ALIAS_DECLARATION@130..157 + 0: TYPE_KW@130..136 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@136..139 + 0: IDENT@136..139 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@139..153 + 0: L_ANGLE@139..140 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@140..151 + 0: TS_TYPE_PARAMETER@140..144 + 0: IN_KW@140..143 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@143..144 + 0: IDENT@143..144 "X" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@144..146 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@146..151 + 0: (empty) + 1: OUT_KW@146..150 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@150..151 + 0: IDENT@150..151 "Y" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@151..153 ">" [] [Whitespace(" ")] + 3: EQ@153..155 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@155..157 + 0: L_CURLY@155..156 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@156..156 + 2: R_CURLY@156..157 "}" [] [] + 5: (empty) + 7: TS_TYPE_ALIAS_DECLARATION@157..184 + 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@163..166 + 0: IDENT@163..166 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@166..180 + 0: L_ANGLE@166..167 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@167..178 + 0: TS_TYPE_PARAMETER@167..172 + 0: (empty) + 1: OUT_KW@167..171 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@171..172 + 0: IDENT@171..172 "X" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@172..174 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@174..178 + 0: IN_KW@174..177 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@177..178 + 0: IDENT@177..178 "Y" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@178..180 ">" [] [Whitespace(" ")] + 3: EQ@180..182 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@182..184 + 0: L_CURLY@182..183 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@183..183 + 2: R_CURLY@183..184 "}" [] [] + 5: (empty) + 8: TS_TYPE_ALIAS_DECLARATION@184..228 + 0: TYPE_KW@184..190 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@190..193 + 0: IDENT@190..193 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@193..224 + 0: L_ANGLE@193..194 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@194..222 + 0: TS_TYPE_PARAMETER@194..199 + 0: (empty) + 1: OUT_KW@194..198 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@198..199 + 0: IDENT@198..199 "X" [] [] + 3: (empty) + 4: (empty) + 1: COMMA@199..201 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@201..222 + 0: (empty) + 1: OUT_KW@201..205 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@205..207 + 0: IDENT@205..207 "Y" [] [Whitespace(" ")] + 3: TS_TYPE_CONSTRAINT_CLAUSE@207..222 + 0: EXTENDS_KW@207..215 "extends" [] [Whitespace(" ")] + 1: TS_TYPE_OPERATOR_TYPE@215..222 + 0: KEYOF_KW@215..221 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@221..222 + 0: JS_REFERENCE_IDENTIFIER@221..222 + 0: IDENT@221..222 "X" [] [] + 1: (empty) + 4: (empty) + 2: R_ANGLE@222..224 ">" [] [Whitespace(" ")] + 3: EQ@224..226 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@226..228 + 0: L_CURLY@226..227 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@227..227 + 2: R_CURLY@227..228 "}" [] [] + 5: (empty) + 9: JS_CLASS_DECLARATION@228..247 + 0: (empty) + 1: CLASS_KW@228..235 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@235..238 + 0: IDENT@235..238 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@238..245 + 0: L_ANGLE@238..239 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@239..243 + 0: TS_TYPE_PARAMETER@239..243 + 0: IN_KW@239..242 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@242..243 + 0: IDENT@242..243 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@243..245 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@245..246 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@246..246 + 8: R_CURLY@246..247 "}" [] [] + 10: JS_CLASS_DECLARATION@247..267 + 0: (empty) + 1: CLASS_KW@247..254 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@254..257 + 0: IDENT@254..257 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@257..265 + 0: L_ANGLE@257..258 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@258..263 + 0: TS_TYPE_PARAMETER@258..263 + 0: (empty) + 1: OUT_KW@258..262 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@262..263 + 0: IDENT@262..263 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@263..265 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@265..266 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@266..266 + 8: R_CURLY@266..267 "}" [] [] + 11: JS_EXPORT@267..301 + 0: EXPORT_KW@267..275 "export" [Newline("\n")] [Whitespace(" ")] + 1: JS_EXPORT_DEFAULT_DECLARATION_CLAUSE@275..301 + 0: DEFAULT_KW@275..283 "default" [] [Whitespace(" ")] + 1: JS_CLASS_EXPORT_DEFAULT_DECLARATION@283..301 + 0: (empty) + 1: CLASS_KW@283..289 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@289..292 + 0: IDENT@289..292 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@292..299 + 0: L_ANGLE@292..293 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@293..297 + 0: TS_TYPE_PARAMETER@293..297 + 0: IN_KW@293..296 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@296..297 + 0: IDENT@296..297 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@297..299 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@299..300 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@300..300 + 8: R_CURLY@300..301 "}" [] [] + 2: (empty) + 12: JS_CLASS_DECLARATION@301..321 + 0: (empty) + 1: CLASS_KW@301..308 "class" [Newline("\n")] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@308..311 + 0: IDENT@308..311 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@311..319 + 0: L_ANGLE@311..312 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@312..317 + 0: TS_TYPE_PARAMETER@312..317 + 0: (empty) + 1: OUT_KW@312..316 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@316..317 + 0: IDENT@316..317 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@317..319 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@319..320 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@320..320 + 8: R_CURLY@320..321 "}" [] [] + 13: TS_INTERFACE_DECLARATION@321..344 + 0: INTERFACE_KW@321..332 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@332..335 + 0: IDENT@332..335 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@335..342 + 0: L_ANGLE@335..336 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@336..340 + 0: TS_TYPE_PARAMETER@336..340 + 0: IN_KW@336..339 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@339..340 + 0: IDENT@339..340 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@340..342 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@342..343 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@343..343 + 6: R_CURLY@343..344 "}" [] [] + 14: TS_INTERFACE_DECLARATION@344..368 + 0: INTERFACE_KW@344..355 "interface" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@355..358 + 0: IDENT@355..358 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@358..366 + 0: L_ANGLE@358..359 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@359..364 + 0: TS_TYPE_PARAMETER@359..364 + 0: (empty) + 1: OUT_KW@359..363 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@363..364 + 0: IDENT@363..364 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@364..366 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@366..367 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@367..367 + 6: R_CURLY@367..368 "}" [] [] + 15: TS_DECLARE_STATEMENT@368..395 + 0: DECLARE_KW@368..377 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@377..395 + 0: (empty) + 1: CLASS_KW@377..383 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@383..386 + 0: IDENT@383..386 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@386..393 + 0: L_ANGLE@386..387 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@387..391 + 0: TS_TYPE_PARAMETER@387..391 + 0: IN_KW@387..390 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@390..391 + 0: IDENT@390..391 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@391..393 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@393..394 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@394..394 + 8: R_CURLY@394..395 "}" [] [] + 16: TS_DECLARE_STATEMENT@395..423 + 0: DECLARE_KW@395..404 "declare" [Newline("\n")] [Whitespace(" ")] + 1: JS_CLASS_DECLARATION@404..423 + 0: (empty) + 1: CLASS_KW@404..410 "class" [] [Whitespace(" ")] + 2: JS_IDENTIFIER_BINDING@410..413 + 0: IDENT@410..413 "Foo" [] [] + 3: TS_TYPE_PARAMETERS@413..421 + 0: L_ANGLE@413..414 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@414..419 + 0: TS_TYPE_PARAMETER@414..419 + 0: (empty) + 1: OUT_KW@414..418 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@418..419 + 0: IDENT@418..419 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@419..421 ">" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: L_CURLY@421..422 "{" [] [] + 7: JS_CLASS_MEMBER_LIST@422..422 + 8: R_CURLY@422..423 "}" [] [] + 17: TS_DECLARE_STATEMENT@423..454 + 0: DECLARE_KW@423..432 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@432..454 + 0: INTERFACE_KW@432..442 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@442..445 + 0: IDENT@442..445 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@445..452 + 0: L_ANGLE@445..446 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@446..450 + 0: TS_TYPE_PARAMETER@446..450 + 0: IN_KW@446..449 "in" [] [Whitespace(" ")] + 1: (empty) + 2: TS_TYPE_PARAMETER_NAME@449..450 + 0: IDENT@449..450 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@450..452 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@452..453 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@453..453 + 6: R_CURLY@453..454 "}" [] [] + 18: TS_DECLARE_STATEMENT@454..486 + 0: DECLARE_KW@454..463 "declare" [Newline("\n")] [Whitespace(" ")] + 1: TS_INTERFACE_DECLARATION@463..486 + 0: INTERFACE_KW@463..473 "interface" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@473..476 + 0: IDENT@473..476 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@476..484 + 0: L_ANGLE@476..477 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@477..482 + 0: TS_TYPE_PARAMETER@477..482 + 0: (empty) + 1: OUT_KW@477..481 "out" [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER_NAME@481..482 + 0: IDENT@481..482 "T" [] [] + 3: (empty) + 4: (empty) + 2: R_ANGLE@482..484 ">" [] [Whitespace(" ")] + 3: (empty) + 4: L_CURLY@484..485 "{" [] [] + 5: TS_TYPE_MEMBER_LIST@485..485 + 6: R_CURLY@485..486 "}" [] [] + 3: EOF@486..487 "" [Newline("\n")] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.ts b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.ts new file mode 100644 index 00000000000..fe4789f0cc1 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier.ts @@ -0,0 +1,19 @@ +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +class Foo {} +class Foo {} +export default class Foo {} +class Foo {} +interface Foo {} +interface Foo {} +declare class Foo {} +declare class Foo {} +declare interface Foo {} +declare interface Foo {} diff --git a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast new file mode 100644 index 00000000000..11f21731e91 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast @@ -0,0 +1,496 @@ +JsModule { + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@0..1 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@1..4 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@4..5 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@5..6 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@6..7 "<" [] [], + slash_token: SLASH@7..8 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@8..10 "in" [] [], + }, + r_angle_token: R_ANGLE@10..11 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@11..12 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@12..14 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@14..18 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@18..19 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@19..20 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@20..21 "<" [] [], + slash_token: SLASH@21..22 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@22..25 "out" [] [], + }, + r_angle_token: R_ANGLE@25..26 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@26..27 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@27..29 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@29..32 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@32..36 "out" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@36..37 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@37..38 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@38..39 "<" [] [], + slash_token: SLASH@39..40 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@40..42 "in" [] [], + }, + r_angle_token: R_ANGLE@42..43 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@43..44 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@44..46 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@46..50 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@50..53 "in" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@53..54 "T" [] [], + }, + initializer: missing (optional), + }, + ], + r_angle_token: R_ANGLE@54..55 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@55..56 "<" [] [], + slash_token: SLASH@56..57 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@57..60 "out" [] [], + }, + r_angle_token: R_ANGLE@60..61 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@61..62 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@62..64 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@64..67 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@67..69 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@69..76 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@76..77 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@77..78 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@78..82 "true" [] [], + }, + r_curly_token: R_CURLY@82..83 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@83..84 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@84..85 "<" [] [], + slash_token: SLASH@85..86 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@86..88 "in" [] [], + }, + r_angle_token: R_ANGLE@88..89 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@89..90 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@90..92 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@92..96 "out" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@96..98 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@98..105 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@105..106 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@106..107 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@107..111 "true" [] [], + }, + r_curly_token: R_CURLY@111..112 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@112..113 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@113..114 "<" [] [], + slash_token: SLASH@114..115 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@115..118 "out" [] [], + }, + r_angle_token: R_ANGLE@118..119 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@119..120 ";" [] [], + }, + JsExpressionStatement { + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@120..122 "<" [Newline("\n")] [], + name: JsxName { + value_token: JSX_IDENT@122..125 "in" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [ + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@125..129 "out" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@129..131 "T" [] [Whitespace(" ")], + }, + initializer: missing (optional), + }, + JsxAttribute { + name: JsxName { + value_token: JSX_IDENT@131..138 "extends" [] [], + }, + initializer: JsxAttributeInitializerClause { + eq_token: EQ@138..139 "=" [] [], + value: JsxExpressionAttributeValue { + l_curly_token: L_CURLY@139..140 "{" [] [], + expression: JsBooleanLiteralExpression { + value_token: TRUE_KW@140..144 "true" [] [], + }, + r_curly_token: R_CURLY@144..145 "}" [] [], + }, + }, + }, + ], + r_angle_token: R_ANGLE@145..146 ">" [] [], + }, + children: JsxChildList [], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@146..147 "<" [] [], + slash_token: SLASH@147..148 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@148..150 "in" [] [], + }, + r_angle_token: R_ANGLE@150..151 ">" [] [], + }, + }, + }, + semicolon_token: SEMICOLON@151..152 ";" [] [], + }, + ], + eof_token: EOF@152..153 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..153 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..152 + 0: JS_EXPRESSION_STATEMENT@0..12 + 0: JSX_TAG_EXPRESSION@0..11 + 0: JSX_ELEMENT@0..11 + 0: JSX_OPENING_ELEMENT@0..6 + 0: L_ANGLE@0..1 "<" [] [] + 1: JSX_NAME@1..4 + 0: JSX_IDENT@1..4 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@4..5 + 0: JSX_ATTRIBUTE@4..5 + 0: JSX_NAME@4..5 + 0: JSX_IDENT@4..5 "T" [] [] + 1: (empty) + 4: R_ANGLE@5..6 ">" [] [] + 1: JSX_CHILD_LIST@6..6 + 2: JSX_CLOSING_ELEMENT@6..11 + 0: L_ANGLE@6..7 "<" [] [] + 1: SLASH@7..8 "/" [] [] + 2: JSX_NAME@8..10 + 0: JSX_IDENT@8..10 "in" [] [] + 3: R_ANGLE@10..11 ">" [] [] + 1: SEMICOLON@11..12 ";" [] [] + 1: JS_EXPRESSION_STATEMENT@12..27 + 0: JSX_TAG_EXPRESSION@12..26 + 0: JSX_ELEMENT@12..26 + 0: JSX_OPENING_ELEMENT@12..20 + 0: L_ANGLE@12..14 "<" [Newline("\n")] [] + 1: JSX_NAME@14..18 + 0: JSX_IDENT@14..18 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@18..19 + 0: JSX_ATTRIBUTE@18..19 + 0: JSX_NAME@18..19 + 0: JSX_IDENT@18..19 "T" [] [] + 1: (empty) + 4: R_ANGLE@19..20 ">" [] [] + 1: JSX_CHILD_LIST@20..20 + 2: JSX_CLOSING_ELEMENT@20..26 + 0: L_ANGLE@20..21 "<" [] [] + 1: SLASH@21..22 "/" [] [] + 2: JSX_NAME@22..25 + 0: JSX_IDENT@22..25 "out" [] [] + 3: R_ANGLE@25..26 ">" [] [] + 1: SEMICOLON@26..27 ";" [] [] + 2: JS_EXPRESSION_STATEMENT@27..44 + 0: JSX_TAG_EXPRESSION@27..43 + 0: JSX_ELEMENT@27..43 + 0: JSX_OPENING_ELEMENT@27..38 + 0: L_ANGLE@27..29 "<" [Newline("\n")] [] + 1: JSX_NAME@29..32 + 0: JSX_IDENT@29..32 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@32..37 + 0: JSX_ATTRIBUTE@32..36 + 0: JSX_NAME@32..36 + 0: JSX_IDENT@32..36 "out" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@36..37 + 0: JSX_NAME@36..37 + 0: JSX_IDENT@36..37 "T" [] [] + 1: (empty) + 4: R_ANGLE@37..38 ">" [] [] + 1: JSX_CHILD_LIST@38..38 + 2: JSX_CLOSING_ELEMENT@38..43 + 0: L_ANGLE@38..39 "<" [] [] + 1: SLASH@39..40 "/" [] [] + 2: JSX_NAME@40..42 + 0: JSX_IDENT@40..42 "in" [] [] + 3: R_ANGLE@42..43 ">" [] [] + 1: SEMICOLON@43..44 ";" [] [] + 3: JS_EXPRESSION_STATEMENT@44..62 + 0: JSX_TAG_EXPRESSION@44..61 + 0: JSX_ELEMENT@44..61 + 0: JSX_OPENING_ELEMENT@44..55 + 0: L_ANGLE@44..46 "<" [Newline("\n")] [] + 1: JSX_NAME@46..50 + 0: JSX_IDENT@46..50 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@50..54 + 0: JSX_ATTRIBUTE@50..53 + 0: JSX_NAME@50..53 + 0: JSX_IDENT@50..53 "in" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@53..54 + 0: JSX_NAME@53..54 + 0: JSX_IDENT@53..54 "T" [] [] + 1: (empty) + 4: R_ANGLE@54..55 ">" [] [] + 1: JSX_CHILD_LIST@55..55 + 2: JSX_CLOSING_ELEMENT@55..61 + 0: L_ANGLE@55..56 "<" [] [] + 1: SLASH@56..57 "/" [] [] + 2: JSX_NAME@57..60 + 0: JSX_IDENT@57..60 "out" [] [] + 3: R_ANGLE@60..61 ">" [] [] + 1: SEMICOLON@61..62 ";" [] [] + 4: JS_EXPRESSION_STATEMENT@62..90 + 0: JSX_TAG_EXPRESSION@62..89 + 0: JSX_ELEMENT@62..89 + 0: JSX_OPENING_ELEMENT@62..84 + 0: L_ANGLE@62..64 "<" [Newline("\n")] [] + 1: JSX_NAME@64..67 + 0: JSX_IDENT@64..67 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@67..83 + 0: JSX_ATTRIBUTE@67..69 + 0: JSX_NAME@67..69 + 0: JSX_IDENT@67..69 "T" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@69..83 + 0: JSX_NAME@69..76 + 0: JSX_IDENT@69..76 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@76..83 + 0: EQ@76..77 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@77..83 + 0: L_CURLY@77..78 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@78..82 + 0: TRUE_KW@78..82 "true" [] [] + 2: R_CURLY@82..83 "}" [] [] + 4: R_ANGLE@83..84 ">" [] [] + 1: JSX_CHILD_LIST@84..84 + 2: JSX_CLOSING_ELEMENT@84..89 + 0: L_ANGLE@84..85 "<" [] [] + 1: SLASH@85..86 "/" [] [] + 2: JSX_NAME@86..88 + 0: JSX_IDENT@86..88 "in" [] [] + 3: R_ANGLE@88..89 ">" [] [] + 1: SEMICOLON@89..90 ";" [] [] + 5: JS_EXPRESSION_STATEMENT@90..120 + 0: JSX_TAG_EXPRESSION@90..119 + 0: JSX_ELEMENT@90..119 + 0: JSX_OPENING_ELEMENT@90..113 + 0: L_ANGLE@90..92 "<" [Newline("\n")] [] + 1: JSX_NAME@92..96 + 0: JSX_IDENT@92..96 "out" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@96..112 + 0: JSX_ATTRIBUTE@96..98 + 0: JSX_NAME@96..98 + 0: JSX_IDENT@96..98 "T" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@98..112 + 0: JSX_NAME@98..105 + 0: JSX_IDENT@98..105 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@105..112 + 0: EQ@105..106 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@106..112 + 0: L_CURLY@106..107 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@107..111 + 0: TRUE_KW@107..111 "true" [] [] + 2: R_CURLY@111..112 "}" [] [] + 4: R_ANGLE@112..113 ">" [] [] + 1: JSX_CHILD_LIST@113..113 + 2: JSX_CLOSING_ELEMENT@113..119 + 0: L_ANGLE@113..114 "<" [] [] + 1: SLASH@114..115 "/" [] [] + 2: JSX_NAME@115..118 + 0: JSX_IDENT@115..118 "out" [] [] + 3: R_ANGLE@118..119 ">" [] [] + 1: SEMICOLON@119..120 ";" [] [] + 6: JS_EXPRESSION_STATEMENT@120..152 + 0: JSX_TAG_EXPRESSION@120..151 + 0: JSX_ELEMENT@120..151 + 0: JSX_OPENING_ELEMENT@120..146 + 0: L_ANGLE@120..122 "<" [Newline("\n")] [] + 1: JSX_NAME@122..125 + 0: JSX_IDENT@122..125 "in" [] [Whitespace(" ")] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@125..145 + 0: JSX_ATTRIBUTE@125..129 + 0: JSX_NAME@125..129 + 0: JSX_IDENT@125..129 "out" [] [Whitespace(" ")] + 1: (empty) + 1: JSX_ATTRIBUTE@129..131 + 0: JSX_NAME@129..131 + 0: JSX_IDENT@129..131 "T" [] [Whitespace(" ")] + 1: (empty) + 2: JSX_ATTRIBUTE@131..145 + 0: JSX_NAME@131..138 + 0: JSX_IDENT@131..138 "extends" [] [] + 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@138..145 + 0: EQ@138..139 "=" [] [] + 1: JSX_EXPRESSION_ATTRIBUTE_VALUE@139..145 + 0: L_CURLY@139..140 "{" [] [] + 1: JS_BOOLEAN_LITERAL_EXPRESSION@140..144 + 0: TRUE_KW@140..144 "true" [] [] + 2: R_CURLY@144..145 "}" [] [] + 4: R_ANGLE@145..146 ">" [] [] + 1: JSX_CHILD_LIST@146..146 + 2: JSX_CLOSING_ELEMENT@146..151 + 0: L_ANGLE@146..147 "<" [] [] + 1: SLASH@147..148 "/" [] [] + 2: JSX_NAME@148..150 + 0: JSX_IDENT@148..150 "in" [] [] + 3: R_ANGLE@150..151 ">" [] [] + 1: SEMICOLON@151..152 ";" [] [] + 3: EOF@152..153 "" [Newline("\n")] [] diff --git a/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx new file mode 100644 index 00000000000..7ed076c87d2 --- /dev/null +++ b/crates/rome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx @@ -0,0 +1,7 @@ +; +; +; +; +; +; +; diff --git a/crates/rome_js_syntax/src/generated/kind.rs b/crates/rome_js_syntax/src/generated/kind.rs index 08e4cf1f311..37906f09fb9 100644 --- a/crates/rome_js_syntax/src/generated/kind.rs +++ b/crates/rome_js_syntax/src/generated/kind.rs @@ -149,6 +149,7 @@ pub enum JsSyntaxKind { BIGINT_KW, OVERRIDE_KW, OF_KW, + OUT_KW, JS_NUMBER_LITERAL, JS_BIGINT_LITERAL, JS_STRING_LITERAL, @@ -424,6 +425,7 @@ pub enum JsSyntaxKind { TS_TYPE_PARAMETERS, TS_TYPE_PARAMETER_LIST, TS_TYPE_PARAMETER, + TS_TYPE_PARAMETER_MODIFIER, TS_TYPE_PARAMETER_NAME, TS_TYPE_CONSTRAINT_CLAUSE, TS_DEFAULT_TYPE_CLAUSE, @@ -646,6 +648,7 @@ impl JsSyntaxKind { "bigint" => BIGINT_KW, "override" => OVERRIDE_KW, "of" => OF_KW, + "out" => OUT_KW, _ => return None, }; Some(kw) @@ -791,6 +794,7 @@ impl JsSyntaxKind { BIGINT_KW => "bigint", OVERRIDE_KW => "override", OF_KW => "of", + OUT_KW => "out", JS_STRING_LITERAL => "string literal", _ => return None, }; @@ -799,4 +803,4 @@ impl JsSyntaxKind { } #[doc = r" Utility macro for creating a SyntaxKind through simple macro syntax"] #[macro_export] -macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } +macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [out] => { $ crate :: JsSyntaxKind :: OUT_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } diff --git a/crates/rome_js_syntax/src/generated/nodes.rs b/crates/rome_js_syntax/src/generated/nodes.rs index c64ec252807..bd6b2f572bd 100644 --- a/crates/rome_js_syntax/src/generated/nodes.rs +++ b/crates/rome_js_syntax/src/generated/nodes.rs @@ -11864,18 +11864,22 @@ impl TsTypeParameter { pub const unsafe fn new_unchecked(syntax: SyntaxNode) -> Self { Self { syntax } } pub fn as_fields(&self) -> TsTypeParameterFields { TsTypeParameterFields { + in_modifier_token: self.in_modifier_token(), + out_modifier_token: self.out_modifier_token(), name: self.name(), constraint: self.constraint(), default: self.default(), } } + pub fn in_modifier_token(&self) -> Option { support::token(&self.syntax, 0usize) } + pub fn out_modifier_token(&self) -> Option { support::token(&self.syntax, 1usize) } pub fn name(&self) -> SyntaxResult { - support::required_node(&self.syntax, 0usize) + support::required_node(&self.syntax, 2usize) } pub fn constraint(&self) -> Option { - support::node(&self.syntax, 1usize) + support::node(&self.syntax, 3usize) } - pub fn default(&self) -> Option { support::node(&self.syntax, 2usize) } + pub fn default(&self) -> Option { support::node(&self.syntax, 4usize) } } #[cfg(feature = "serde")] impl Serialize for TsTypeParameter { @@ -11888,6 +11892,8 @@ impl Serialize for TsTypeParameter { } #[cfg_attr(feature = "serde", derive(Serialize))] pub struct TsTypeParameterFields { + pub in_modifier_token: Option, + pub out_modifier_token: Option, pub name: SyntaxResult, pub constraint: Option, pub default: Option, @@ -24750,6 +24756,14 @@ impl AstNode for TsTypeParameter { impl std::fmt::Debug for TsTypeParameter { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("TsTypeParameter") + .field( + "in_modifier_token", + &support::DebugOptionalElement(self.in_modifier_token()), + ) + .field( + "out_modifier_token", + &support::DebugOptionalElement(self.out_modifier_token()), + ) .field("name", &support::DebugSyntaxResult(self.name())) .field( "constraint", diff --git a/crates/rome_js_syntax/src/generated/nodes_mut.rs b/crates/rome_js_syntax/src/generated/nodes_mut.rs index 371134b4bdb..6c1739d12c5 100644 --- a/crates/rome_js_syntax/src/generated/nodes_mut.rs +++ b/crates/rome_js_syntax/src/generated/nodes_mut.rs @@ -5830,21 +5830,33 @@ impl TsTypeOperatorType { } } impl TsTypeParameter { + pub fn with_in_modifier_token(self, element: Option) -> Self { + Self::unwrap_cast( + self.syntax + .splice_slots(0usize..=0usize, once(element.map(|element| element.into()))), + ) + } + pub fn with_out_modifier_token(self, element: Option) -> Self { + Self::unwrap_cast( + self.syntax + .splice_slots(1usize..=1usize, once(element.map(|element| element.into()))), + ) + } pub fn with_name(self, element: TsTypeParameterName) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(0usize..=0usize, once(Some(element.into_syntax().into()))), + .splice_slots(2usize..=2usize, once(Some(element.into_syntax().into()))), ) } pub fn with_constraint(self, element: Option) -> Self { Self::unwrap_cast(self.syntax.splice_slots( - 1usize..=1usize, + 3usize..=3usize, once(element.map(|element| element.into_syntax().into())), )) } pub fn with_default(self, element: Option) -> Self { Self::unwrap_cast(self.syntax.splice_slots( - 2usize..=2usize, + 4usize..=4usize, once(element.map(|element| element.into_syntax().into())), )) } diff --git a/crates/rome_js_syntax/src/lib.rs b/crates/rome_js_syntax/src/lib.rs index cf5f7c69f41..df477d39b90 100644 --- a/crates/rome_js_syntax/src/lib.rs +++ b/crates/rome_js_syntax/src/lib.rs @@ -61,7 +61,7 @@ impl JsSyntaxKind { /// Returns `true` for any contextual (await) or non-contextual keyword #[inline] pub const fn is_keyword(self) -> bool { - (self as u16) <= (JsSyntaxKind::OF_KW as u16) + (self as u16) <= (JsSyntaxKind::OUT_KW as u16) && (self as u16) >= (JsSyntaxKind::BREAK_KW as u16) } @@ -69,7 +69,7 @@ impl JsSyntaxKind { #[inline] pub const fn is_contextual_keyword(self) -> bool { (self as u16) >= (JsSyntaxKind::ABSTRACT_KW as u16) - && (self as u16) <= (JsSyntaxKind::OF_KW as u16) + && (self as u16) <= (JsSyntaxKind::OUT_KW as u16) } /// Returns true for all non-contextual keywords (includes future reserved keywords) diff --git a/xtask/codegen/js.ungram b/xtask/codegen/js.ungram index 7bacb4d4792..99ab285966b 100644 --- a/xtask/codegen/js.ungram +++ b/xtask/codegen/js.ungram @@ -1919,6 +1919,8 @@ TsTypeParameterList = (TsTypeParameter (',' TsTypeParameter)* ','?) // type A = { b: B } // ^^^^^^^^^^^^^^^^^^^^^^ TsTypeParameter = + in_modifier: 'in' ? + out_modifier: 'out'? name: TsTypeParameterName constraint: TsTypeConstraintClause? default: TsDefaultTypeClause? diff --git a/xtask/codegen/src/kinds_src.rs b/xtask/codegen/src/kinds_src.rs index f658358417f..82a1740a0a3 100644 --- a/xtask/codegen/src/kinds_src.rs +++ b/xtask/codegen/src/kinds_src.rs @@ -162,6 +162,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "bigint", "override", "of", + "out", ], literals: &[ "JS_NUMBER_LITERAL", @@ -444,6 +445,7 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "TS_TYPE_PARAMETERS", "TS_TYPE_PARAMETER_LIST", "TS_TYPE_PARAMETER", + "TS_TYPE_PARAMETER_MODIFIER", "TS_TYPE_PARAMETER_NAME", "TS_TYPE_CONSTRAINT_CLAUSE", "TS_DEFAULT_TYPE_CLAUSE",