diff --git a/.github/workflows/parser_conformance.yml b/.github/workflows/parser_conformance.yml index e9b9093409c2..84b82e8ee3a3 100644 --- a/.github/workflows/parser_conformance.yml +++ b/.github/workflows/parser_conformance.yml @@ -8,7 +8,7 @@ on: - 'crates/biome_js_syntax/**' - 'crates/biome_js_factory/**' - 'crates/biome_js_semantic/**' - - 'crates/rome_js_parser/**' + - 'crates/biome_js_parser/**' - 'crates/biome_rowan/**' - 'xtask/**' diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e401cf34356..a78d2fc86739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom - Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4 ### Parser + +- Enhance diagnostic for infer type handling in the parser. The 'infer' keyword can only be utilized within the 'extends' clause of a conditional type. Using it outside of this context will result in an error. Ensure that any type declarations using 'infer' are correctly placed within the conditional type structure to avoid parsing issues. Contributed by @denbezrukov + ### VSCode ## 1.2.2 (2023-09-16) diff --git a/crates/biome_js_formatter/src/ts/types/infer_type.rs b/crates/biome_js_formatter/src/ts/types/infer_type.rs index c8897fec27b5..d87a5d315bed 100644 --- a/crates/biome_js_formatter/src/ts/types/infer_type.rs +++ b/crates/biome_js_formatter/src/ts/types/infer_type.rs @@ -47,14 +47,31 @@ mod tests { #[test] fn needs_parentheses() { - assert_needs_parentheses!("let s: (infer string)[] = symbol();", TsInferType); + assert_needs_parentheses!( + "type A = T extends (infer string)[] ? string : never", + TsInferType + ); + assert_needs_parentheses!( + "type A = T extends unique (infer string) ? string : never", + TsInferType + ); - assert_needs_parentheses!("let s: unique (infer string);", TsInferType); + assert_not_needs_parentheses!( + "type A = T extends [number, ...infer string] ? string : never", + TsInferType + ); + assert_needs_parentheses!( + "type A = T extends [(infer string)?] ? string : never", + TsInferType + ); - assert_not_needs_parentheses!("let s: [number, ...infer string]", TsInferType); - assert_needs_parentheses!("let s: [(infer string)?]", TsInferType); - - assert_needs_parentheses!("let s: (infer string)[a]", TsInferType); - assert_not_needs_parentheses!("let s: a[(infer string)]", TsInferType); + assert_needs_parentheses!( + "type A = T extends (infer string)[a] ? string : never", + TsInferType + ); + assert_not_needs_parentheses!( + "type A = T extends a[(infer string)] ? string : never", + TsInferType + ); } } diff --git a/crates/biome_js_parser/src/syntax/class.rs b/crates/biome_js_parser/src/syntax/class.rs index 92168e2f770a..fb3b9efc2574 100644 --- a/crates/biome_js_parser/src/syntax/class.rs +++ b/crates/biome_js_parser/src/syntax/class.rs @@ -402,9 +402,11 @@ fn parse_extends_clause(p: &mut JsParser) -> ParsedSyntax { p.error(p.err_builder("'extends' list cannot be empty.", extends_end..extends_end)) } else { TypeScript - .parse_exclusive_syntax(p, parse_ts_type_arguments, |p, arguments| { - ts_only_syntax_error(p, "type arguments", arguments.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_type_arguments(p, TypeContext::default()), + |p, arguments| ts_only_syntax_error(p, "type arguments", arguments.range(p)), + ) .ok(); } @@ -419,7 +421,7 @@ fn parse_extends_clause(p: &mut JsParser) -> ParsedSyntax { break; } - parse_ts_type_arguments(p).ok(); + parse_ts_type_arguments(p, TypeContext::default()).ok(); let extra_class = extra.complete(p, JS_BOGUS); @@ -605,6 +607,7 @@ fn parse_index_signature_class_member(p: &mut JsParser, member_marker: Marker) - p, member_marker, MemberParent::Class, + TypeContext::default(), )) }, |p, member| ts_only_syntax_error(p, "Index signatures", member.range(p)), @@ -762,6 +765,7 @@ fn parse_class_member_impl( decorator_list, ParameterContext::ClassSetter, ExpressionContext::default().and_object_expression_allowed(has_l_paren), + TypeContext::default(), ) }) .or_add_diagnostic(p, js_parse_error::expected_parameter); @@ -771,7 +775,9 @@ fn parse_class_member_impl( // class Test { // set a(value: string): void {} // } - if let Present(return_type_annotation) = parse_ts_return_type_annotation(p) { + if let Present(return_type_annotation) = + parse_ts_return_type_annotation(p, TypeContext::default()) + { p.error(ts_set_accessor_return_type_error( p, &return_type_annotation, @@ -1124,17 +1130,17 @@ fn parse_ts_property_annotation( let mut annotation = match (optional_range, definite_range) { (Some(_), None) => { - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, TypeContext::default()).ok(); m.complete(p, TS_OPTIONAL_PROPERTY_ANNOTATION) } (None, Some(_)) => { - parse_ts_type_annotation(p).or_add_diagnostic(p, |p, range| { + parse_ts_type_annotation(p, TypeContext::default()).or_add_diagnostic(p, |p, range| { p.err_builder("Properties with definite assignment assertions must also have type annotations.",range, ) }); m.complete(p, TS_DEFINITE_PROPERTY_ANNOTATION) } (Some(optional_range), Some(definite_range)) => { - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, TypeContext::default()).ok(); let error = p .err_builder( "class properties cannot be both optional and definite", @@ -1246,13 +1252,15 @@ fn parse_method_class_member_rest( ParameterContext::ClassImplementation }; - parse_parameter_list(p, parameter_context, flags) + parse_parameter_list(p, parameter_context, TypeContext::default(), flags) .or_add_diagnostic(p, js_parse_error::expected_class_parameters); TypeScript - .parse_exclusive_syntax(p, parse_ts_return_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "return type annotation", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_return_type_annotation(p, TypeContext::default()), + |p, annotation| ts_only_syntax_error(p, "return type annotation", annotation.range(p)), + ) .ok(); let member_kind = expect_method_body(p, &m, modifiers, ClassMethodMemberKind::Method(flags)); @@ -1523,7 +1531,7 @@ fn parse_constructor_class_member_body( parse_constructor_parameter_list(p) .or_add_diagnostic(p, js_parse_error::expected_constructor_parameters); - if let Present(marker) = parse_ts_type_annotation(p) { + if let Present(marker) = parse_ts_type_annotation(p, TypeContext::default()) { let err = p.err_builder("constructors cannot have type annotations", marker.range(p)); p.error(err); @@ -1612,8 +1620,14 @@ fn parse_constructor_parameter(p: &mut JsParser, context: ExpressionContext) -> let modifiers = parse_class_member_modifiers(p, true); // we pass decorator list as Absent because TsPropertyParameter has its own decorator list - parse_formal_parameter(p, Absent, ParameterContext::ParameterProperty, context) - .or_add_diagnostic(p, expected_binding); + parse_formal_parameter( + p, + Absent, + ParameterContext::ParameterProperty, + context, + TypeContext::default(), + ) + .or_add_diagnostic(p, expected_binding); let kind = if modifiers.validate_and_complete(p, TS_PROPERTY_PARAMETER) { TS_PROPERTY_PARAMETER @@ -1628,6 +1642,7 @@ fn parse_constructor_parameter(p: &mut JsParser, context: ExpressionContext) -> decorator_list, ParameterContext::ClassImplementation, context, + TypeContext::default(), ) .map(|mut parameter| { // test_err ts ts_constructor_this_parameter diff --git a/crates/biome_js_parser/src/syntax/function.rs b/crates/biome_js_parser/src/syntax/function.rs index baf5293c512a..c0de5f722c29 100644 --- a/crates/biome_js_parser/src/syntax/function.rs +++ b/crates/biome_js_parser/src/syntax/function.rs @@ -255,16 +255,20 @@ fn parse_function(p: &mut JsParser, m: Marker, kind: FunctionKind) -> CompletedM ParameterContext::Implementation }; - parse_parameter_list(p, parameter_context, flags) + parse_parameter_list(p, parameter_context, TypeContext::default(), flags) .or_add_diagnostic(p, js_parse_error::expected_parameters); TypeScript - .parse_exclusive_syntax(p, parse_ts_return_type_annotation, |p, marker| { - p.err_builder( - "return types can only be used in TypeScript files", - marker.range(p), - ) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_return_type_annotation(p, TypeContext::default()), + |p, marker| { + p.err_builder( + "return types can only be used in TypeScript files", + marker.range(p), + ) + }, + ) .ok(); let body = parse_function_body(p, flags); @@ -416,9 +420,14 @@ fn parse_ambient_function( let binding_range = p.cur_range(); parse_ts_type_parameters(p, TypeContext::default().and_allow_const_modifier(true)).ok(); - parse_parameter_list(p, ParameterContext::Declaration, SignatureFlags::empty()) - .or_add_diagnostic(p, expected_parameters); - parse_ts_return_type_annotation(p).ok(); + parse_parameter_list( + p, + ParameterContext::Declaration, + TypeContext::default(), + SignatureFlags::empty(), + ) + .or_add_diagnostic(p, expected_parameters); + parse_ts_return_type_annotation(p, TypeContext::default()).ok(); if let Present(body) = parse_function_body(p, SignatureFlags::empty()) { p.error( @@ -460,13 +469,17 @@ fn parse_ambient_function( } pub(crate) fn parse_ts_type_annotation_or_error(p: &mut JsParser) -> ParsedSyntax { - TypeScript.parse_exclusive_syntax(p, parse_ts_type_annotation, |p, annotation| { - p.err_builder( - "return types can only be used in TypeScript files", - annotation.range(p), - ) - .hint("remove this type annotation") - }) + TypeScript.parse_exclusive_syntax( + p, + |p| parse_ts_type_annotation(p, TypeContext::default()), + |p, annotation| { + p.err_builder( + "return types can only be used in TypeScript files", + annotation.range(p), + ) + .hint("remove this type annotation") + }, + ) } /// Tells [is_at_async_function] if it needs to check line breaks @@ -562,6 +575,7 @@ fn try_parse_parenthesized_arrow_function_head( parse_parameter_list( p, ParameterContext::Arrow, + TypeContext::default(), arrow_function_parameter_flags(p, flags), ) .or_add_diagnostic(p, expected_parameters); @@ -571,9 +585,11 @@ fn try_parse_parenthesized_arrow_function_head( } TypeScript - .parse_exclusive_syntax(p, parse_ts_return_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "return type annotation", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_return_type_annotation(p, TypeContext::default()), + |p, annotation| ts_only_syntax_error(p, "return type annotation", annotation.range(p)), + ) .ok(); if p.has_preceding_line_break() { @@ -884,6 +900,7 @@ pub(crate) fn parse_any_parameter( decorator_list: ParsedSyntax, parameter_context: ParameterContext, expression_context: ExpressionContext, + type_context: TypeContext, ) -> ParsedSyntax { let parameter = match p.cur() { T![...] => parse_rest_parameter(p, decorator_list, expression_context), @@ -900,9 +917,15 @@ pub(crate) fn parse_any_parameter( decorator_list.change_to_bogus(p); decorator_list }); - parse_ts_this_parameter(p) + parse_ts_this_parameter(p, type_context) } - _ => parse_formal_parameter(p, decorator_list, parameter_context, expression_context), + _ => parse_formal_parameter( + p, + decorator_list, + parameter_context, + expression_context, + type_context, + ), }; parameter.map(|mut parameter| { @@ -955,9 +978,11 @@ pub(crate) fn parse_rest_parameter( // type annotation `...foo: number[]` TypeScript - .parse_exclusive_syntax(p, parse_ts_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "type annotation", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_type_annotation(p, TypeContext::default()), + |p, annotation| ts_only_syntax_error(p, "type annotation", annotation.range(p)), + ) .ok(); if let Present(initializer) = parse_initializer_clause(p, ExpressionContext::default()) { @@ -994,14 +1019,14 @@ pub(crate) fn parse_rest_parameter( // test ts ts_this_parameter // function a(this) {} // function b(this: string) {} -pub(crate) fn parse_ts_this_parameter(p: &mut JsParser) -> ParsedSyntax { +pub(crate) fn parse_ts_this_parameter(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![this]) { return Absent; } let parameter = p.start(); p.expect(T![this]); - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, context).ok(); Present(parameter.complete(p, TS_THIS_PARAMETER)) } @@ -1077,6 +1102,7 @@ pub(crate) fn parse_formal_parameter( decorator_list: ParsedSyntax, parameter_context: ParameterContext, expression_context: ExpressionContext, + type_context: TypeContext, ) -> ParsedSyntax { // test ts ts_formal_parameter_decorator { "parse_class_parameter_decorators": true } // class Foo { @@ -1149,9 +1175,11 @@ pub(crate) fn parse_formal_parameter( } TypeScript - .parse_exclusive_syntax(p, parse_ts_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "Type annotations", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_type_annotation(p, type_context), + |p, annotation| ts_only_syntax_error(p, "Type annotations", annotation.range(p)), + ) .ok(); if let Present(initializer) = parse_initializer_clause(p, expression_context) { @@ -1208,6 +1236,7 @@ pub(super) fn skip_parameter_start(p: &mut JsParser) -> bool { pub(super) fn parse_parameter_list( p: &mut JsParser, parameter_context: ParameterContext, + type_context: TypeContext, flags: SignatureFlags, ) -> ParsedSyntax { if !p.at(T!['(']) { @@ -1288,7 +1317,13 @@ pub(super) fn parse_parameter_list( .into() }; - parse_any_parameter(p, decorator_list, parameter_context, expression_context) + parse_any_parameter( + p, + decorator_list, + parameter_context, + expression_context, + type_context, + ) }, JS_PARAMETER_LIST, ); diff --git a/crates/biome_js_parser/src/syntax/jsx/mod.rs b/crates/biome_js_parser/src/syntax/jsx/mod.rs index b7b1481c74f5..3ae345b854cc 100644 --- a/crates/biome_js_parser/src/syntax/jsx/mod.rs +++ b/crates/biome_js_parser/src/syntax/jsx/mod.rs @@ -15,6 +15,7 @@ use crate::syntax::jsx::jsx_parse_errors::{ jsx_expected_attribute, jsx_expected_attribute_value, jsx_expected_children, jsx_expected_closing_tag, }; +use crate::syntax::typescript::TypeContext; use crate::JsSyntaxFeature::TypeScript; use crate::{parser::RecoveryResult, JsParser, ParseRecovery, ParsedSyntax}; use crate::{Absent, Present}; @@ -158,7 +159,7 @@ fn parse_any_jsx_opening_tag(p: &mut JsParser, in_expression: bool) -> Option; // />; // >; - let _ = parse_ts_type_arguments(p); + let _ = parse_ts_type_arguments(p, TypeContext::default()); } JsxAttributeList.parse_list(p); diff --git a/crates/biome_js_parser/src/syntax/object.rs b/crates/biome_js_parser/src/syntax/object.rs index 31e2ae27b9d2..344a55c5b67a 100644 --- a/crates/biome_js_parser/src/syntax/object.rs +++ b/crates/biome_js_parser/src/syntax/object.rs @@ -269,9 +269,11 @@ fn parse_getter_object_member(p: &mut JsParser) -> ParsedSyntax { p.expect(T![')']); TypeScript - .parse_exclusive_syntax(p, parse_ts_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "type annotation", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_type_annotation(p, TypeContext::default()), + |p, annotation| ts_only_syntax_error(p, "type annotation", annotation.range(p)), + ) .ok(); parse_function_body(p, SignatureFlags::empty()) @@ -322,6 +324,7 @@ fn parse_setter_object_member(p: &mut JsParser) -> ParsedSyntax { decorator_list, ParameterContext::Setter, ExpressionContext::default().and_object_expression_allowed(has_l_paren), + TypeContext::default(), ) .or_add_diagnostic(p, js_parse_error::expected_parameter); p.expect(T![')']); @@ -329,7 +332,9 @@ fn parse_setter_object_member(p: &mut JsParser) -> ParsedSyntax { // test_err ts ts_object_setter_return_type // ({ set a(value: string): void {} }); - if let Present(return_type_annotation) = parse_ts_return_type_annotation(p) { + if let Present(return_type_annotation) = + parse_ts_return_type_annotation(p, TypeContext::default()) + { p.error(ts_set_accessor_return_type_error( p, &return_type_annotation, @@ -462,13 +467,20 @@ fn parse_method_object_member_body(p: &mut JsParser, flags: SignatureFlags) { ) .ok(); - parse_parameter_list(p, ParameterContext::Implementation, flags) - .or_add_diagnostic(p, js_parse_error::expected_parameters); + parse_parameter_list( + p, + ParameterContext::Implementation, + TypeContext::default(), + flags, + ) + .or_add_diagnostic(p, js_parse_error::expected_parameters); TypeScript - .parse_exclusive_syntax(p, parse_ts_return_type_annotation, |p, annotation| { - ts_only_syntax_error(p, "return type annotation", annotation.range(p)) - }) + .parse_exclusive_syntax( + p, + |p| parse_ts_return_type_annotation(p, TypeContext::default()), + |p, annotation| ts_only_syntax_error(p, "return type annotation", annotation.range(p)), + ) .ok(); parse_function_body(p, flags).or_add_diagnostic(p, js_parse_error::expected_function_body); diff --git a/crates/biome_js_parser/src/syntax/stmt.rs b/crates/biome_js_parser/src/syntax/stmt.rs index fbd76450fbcc..ca0ffc1ba452 100644 --- a/crates/biome_js_parser/src/syntax/stmt.rs +++ b/crates/biome_js_parser/src/syntax/stmt.rs @@ -1506,7 +1506,7 @@ fn parse_variable_declarator( // !function test() {} fn parse_ts_variable_annotation(p: &mut JsParser) -> ParsedSyntax { if !p.at(T![!]) { - return parse_ts_type_annotation(p); + return parse_ts_type_annotation(p, TypeContext::default()); } if p.has_preceding_line_break() { @@ -1516,7 +1516,8 @@ fn parse_ts_variable_annotation(p: &mut JsParser) -> ParsedSyntax { let m = p.start(); p.bump(T![!]); - parse_ts_type_annotation(p).or_add_diagnostic(p, |_, _| expected_token(T![:])); + parse_ts_type_annotation(p, TypeContext::default()) + .or_add_diagnostic(p, |_, _| expected_token(T![:])); Present(m.complete(p, TS_DEFINITE_VARIABLE_ANNOTATION)) } diff --git a/crates/biome_js_parser/src/syntax/typescript.rs b/crates/biome_js_parser/src/syntax/typescript.rs index a8e88a2a2efc..f0603ca9d5b6 100644 --- a/crates/biome_js_parser/src/syntax/typescript.rs +++ b/crates/biome_js_parser/src/syntax/typescript.rs @@ -124,7 +124,7 @@ fn parse_ts_name_with_type_arguments(p: &mut JsParser) -> ParsedSyntax { let m = name.precede(p); if !p.has_preceding_line_break() { - parse_ts_type_arguments(p).ok(); + parse_ts_type_arguments(p, TypeContext::default()).ok(); } m.complete(p, TS_NAME_WITH_TYPE_ARGUMENTS) @@ -176,6 +176,7 @@ pub(crate) fn expect_ts_index_signature_member( p: &mut JsParser, m: Marker, parent: MemberParent, + context: TypeContext, ) -> CompletedMarker { while is_nth_at_modifier(p, 0, false) { if p.eat(T![readonly]) { @@ -195,12 +196,12 @@ pub(crate) fn expect_ts_index_signature_member( let parameter = p.start(); parse_identifier_binding(p).or_add_diagnostic(p, expected_identifier); - parse_ts_type_annotation(p).unwrap(); // It's a computed member name if the type annotation is missing + parse_ts_type_annotation(p, context).unwrap(); // It's a computed member name if the type annotation is missing parameter.complete(p, TS_INDEX_SIGNATURE_PARAMETER); p.expect(T![']']); - parse_ts_type_annotation(p).or_add_diagnostic(p, |p, range| { + parse_ts_type_annotation(p, context).or_add_diagnostic(p, |p, range| { p.err_builder("An index signature must have a type annotation", range) }); diff --git a/crates/biome_js_parser/src/syntax/typescript/statement.rs b/crates/biome_js_parser/src/syntax/typescript/statement.rs index 9563fa1e3a1f..7deaac97c575 100644 --- a/crates/biome_js_parser/src/syntax/typescript/statement.rs +++ b/crates/biome_js_parser/src/syntax/typescript/statement.rs @@ -304,7 +304,7 @@ pub(crate) fn parse_ts_interface_declaration(p: &mut JsParser) -> ParsedSyntax { 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); + TypeMembers::default().parse_list(p); p.expect(T!['}']); Present(m.complete(p, TS_INTERFACE_DECLARATION)) diff --git a/crates/biome_js_parser/src/syntax/typescript/ts_parse_error.rs b/crates/biome_js_parser/src/syntax/typescript/ts_parse_error.rs index e9257fcbca38..4a6630cd25f0 100644 --- a/crates/biome_js_parser/src/syntax/typescript/ts_parse_error.rs +++ b/crates/biome_js_parser/src/syntax/typescript/ts_parse_error.rs @@ -128,3 +128,10 @@ pub(crate) fn expected_ts_type(p: &JsParser, range: TextRange) -> ParseDiagnosti pub(crate) fn expected_ts_type_parameter(p: &JsParser, range: TextRange) -> ParseDiagnostic { expected_node("type parameter", range).into_diagnostic(p) } + +pub(crate) fn infer_not_allowed(p: &JsParser, range: TextRange) -> ParseDiagnostic { + p.err_builder( + "'infer' declarations are only permitted in the 'extends' clause of a conditional type.", + range, + ) +} diff --git a/crates/biome_js_parser/src/syntax/typescript/types.rs b/crates/biome_js_parser/src/syntax/typescript/types.rs index d1c106a4de21..1c4f8168a20a 100644 --- a/crates/biome_js_parser/src/syntax/typescript/types.rs +++ b/crates/biome_js_parser/src/syntax/typescript/types.rs @@ -21,7 +21,7 @@ use crate::syntax::object::{ use crate::syntax::stmt::optional_semi; use crate::syntax::typescript::try_parse; use crate::syntax::typescript::ts_parse_error::{ - expected_ts_type, expected_ts_type_parameter, + expected_ts_type, expected_ts_type_parameter, infer_not_allowed, ts_const_modifier_cannot_appear_on_a_type_parameter, ts_in_out_modifier_cannot_appear_on_a_type_parameter, }; @@ -58,6 +58,9 @@ bitflags! { /// /// By default, 'const' modifier is not allowed. const ALLOW_CONST_MODIFIER = 1 << 2; + + /// Whether the parser is inside a conditional extends + const IN_CONDITIONAL_EXTENDS = 1 << 3; } } @@ -74,6 +77,10 @@ impl TypeContext { self.and(TypeContext::ALLOW_CONST_MODIFIER, allow) } + pub(crate) fn and_in_conditional_extends(self, allow: bool) -> Self { + self.and(TypeContext::IN_CONDITIONAL_EXTENDS, allow) + } + pub(crate) const fn is_conditional_type_allowed(&self) -> bool { !self.contains(TypeContext::DISALLOW_CONDITIONAL_TYPES) } @@ -86,6 +93,10 @@ impl TypeContext { self.contains(TypeContext::ALLOW_CONST_MODIFIER) } + pub(crate) const fn in_conditional_extends(&self) -> bool { + self.contains(TypeContext::IN_CONDITIONAL_EXTENDS) + } + /// Adds the `flag` if `set` is `true`, otherwise removes the `flag` fn and(self, flag: TypeContext, set: bool) -> Self { if set { @@ -119,14 +130,14 @@ pub(crate) fn is_reserved_module_name(name: &str) -> bool { name.len() == 4 && matches!(name, "void" | "null") } -pub(crate) fn parse_ts_type_annotation(p: &mut JsParser) -> ParsedSyntax { +pub(crate) fn parse_ts_type_annotation(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![:]) { return Absent; } let m = p.start(); p.bump(T![:]); - parse_ts_type(p, TypeContext::default()).or_add_diagnostic(p, expected_ts_type); + parse_ts_type(p, context).or_add_diagnostic(p, expected_ts_type); Present(m.complete(p, TS_TYPE_ANNOTATION)) } @@ -136,22 +147,30 @@ pub(crate) fn parse_ts_type_annotation(p: &mut JsParser) -> ParsedSyntax { // type C = { (a): a is string } // const a = { test(x): x is string { return typeof x === "string" } } // class D { test(x): x is string { return typeof x === "string"; } } -pub(crate) fn parse_ts_return_type_annotation(p: &mut JsParser) -> ParsedSyntax { +pub(crate) fn parse_ts_return_type_annotation( + p: &mut JsParser, + context: TypeContext, +) -> ParsedSyntax { if !p.at(T![:]) { return Absent; } let m = p.start(); p.bump(T![:]); - parse_ts_return_type(p, TypeContext::default()).or_add_diagnostic(p, expected_ts_type); + parse_ts_return_type(p, context).or_add_diagnostic(p, expected_ts_type); Present(m.complete(p, TS_RETURN_TYPE_ANNOTATION)) } fn parse_ts_call_signature(p: &mut JsParser, context: TypeContext) { parse_ts_type_parameters(p, context).ok(); - parse_parameter_list(p, ParameterContext::Declaration, SignatureFlags::empty()) - .or_add_diagnostic(p, expected_parameters); - parse_ts_return_type_annotation(p).ok(); + parse_parameter_list( + p, + ParameterContext::Declaration, + context, + SignatureFlags::empty(), + ) + .or_add_diagnostic(p, expected_parameters); + parse_ts_return_type_annotation(p, context).ok(); } fn parse_ts_type_parameter_name(p: &mut JsParser) -> ParsedSyntax { @@ -518,8 +537,13 @@ pub(crate) fn parse_ts_type(p: &mut JsParser, context: TypeContext) -> ParsedSyn let m = left.precede(p); p.expect(T![extends]); - parse_ts_type(p, context.and_allow_conditional_types(false)) - .or_add_diagnostic(p, expected_ts_type); + parse_ts_type( + p, + context + .and_allow_conditional_types(false) + .and_in_conditional_extends(true), + ) + .or_add_diagnostic(p, expected_ts_type); p.expect(T![?]); parse_ts_type(p, context).or_add_diagnostic(p, expected_ts_type); p.expect(T![:]); @@ -645,14 +669,74 @@ fn eat_ts_union_or_intersection_type_elements( fn parse_ts_primary_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { // test ts ts_inferred_type - // type A = infer B; - // type B = { a: infer U; b: infer U}; + // type A = A extends infer B ? B : never; + // type B = A extends { a: infer U; b: infer U} ? U : never; if p.at(T![infer]) { let m = p.start(); p.expect(T![infer]); parse_ts_type_parameter_name(p).or_add_diagnostic(p, expected_identifier); try_parse_constraint_of_infer_type(p, context).ok(); - return Present(m.complete(p, TS_INFER_TYPE)); + + return if context.in_conditional_extends() { + // test ts ts_infer_type_allowed + // type A = T extends import("test").C ? P : never + // type A = T extends typeof Array ? P : never + // type A = T extends { set(a: infer P): number } ? P : never + // type A = T extends { get(): infer P } ? P : never + // type A = T extends { method(this: infer P): number } ? P : never + // type valid9 = T extends Array ? R : any; + // type ContentBetweenBrackets = S extends `[${infer T}]` ? T : never; + // type WithSelectors = S extends { getState: () => infer T } + // ? S & { use: { [K in keyof T]: () => T[K] } } + // : never; + // type A = MyType extends (OtherType extends infer T ? infer U : InnerFalse) ? OuterTrue : OuterFalse + // type Join = + // T extends [] ? '' : + // T extends [string | number | boolean | bigint] ? `${T[0]}` : + // T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : + // string; + // type MatchPair = S extends `[${infer A},${infer B}]` ? [A, B] : unknown; + // type FirstTwoAndRest = S extends `${infer A}${infer B}${infer R}` ? [`${A}${B}`, R] : unknown; + // type Trim = + // S extends `${infer T} ` ? Trim : + // S; + // type Foo = T extends `*${infer S}*` ? S : never; + // type Unpacked = T extends (infer U)[] ? U : + // T extends (...args: any[]) => infer U ? U : + // T extends Promise ? U : + // T; + // type ArgumentType any> = T extends (a: infer A) => any ? A : any; + // type X3 = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U : never; + // type X1 = T extends { x: infer X, y: infer Y } ? [X, Y] : any; + // type T62 = U extends (infer U)[] ? U : U; + // type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; + // type T75 = T extends T74 ? T70 | T72 | T74 : never; + // type Jsonified = T extends string | number | boolean | null ? T + // : T extends undefined | Function ? never + // : T extends { toJSON(): infer R } ? R + // : T extends object ? JsonifiedObject + // : "what is this"; + Present(m.complete(p, TS_INFER_TYPE)) + } else { + // test_err ts ts_infer_type_not_allowed + // type WithSelectors = S extends { getState: () => infer T } + // ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + // : never; + // type TV1 = `${infer X}`; + // type T61 = (infer A) extends infer B ? infer C : infer D; + // type A = {a: infer T} + // type A = () => infer T; + // let s: (infer string)[] = symbol(); + // let s: unique (infer string); + // let s: [number, ...infer string] + // let s: [(infer string)?] + // let s: (infer string)[a] + // let s: a[(infer string)] + let infer_type = m.complete(p, TS_BOGUS_TYPE); + p.error(infer_not_allowed(p, infer_type.range(p))); + + Present(infer_type) + }; } // test ts ts_type_operator @@ -732,12 +816,12 @@ fn parse_ts_non_array_type(p: &mut JsParser, context: TypeContext) -> ParsedSynt // type J = null; // type K = never match p.cur() { - T!['('] => parse_ts_parenthesized_type(p), + T!['('] => parse_ts_parenthesized_type(p, context), T!['{'] => { if is_at_start_of_mapped_type(p) { parse_ts_mapped_type(p, context) } else { - parse_ts_object_type(p) + parse_ts_object_type(p, context) } } T!['['] => parse_ts_tuple_type(p, context), @@ -754,12 +838,12 @@ fn parse_ts_non_array_type(p: &mut JsParser, context: TypeContext) -> ParsedSynt T![this] => parse_ts_this_type(p), T![typeof] => { if p.nth_at(1, T![import]) { - parse_ts_import_type(p) + parse_ts_import_type(p, context) } else { - parse_ts_typeof_type(p) + parse_ts_typeof_type(p, context) } } - T![import] => parse_ts_import_type(p), + T![import] => parse_ts_import_type(p, context), _ => { if !p.nth_at(1, T![.]) { let mapping = match p.cur() { @@ -783,7 +867,7 @@ fn parse_ts_non_array_type(p: &mut JsParser, context: TypeContext) -> ParsedSynt } } - parse_ts_reference_type(p) + parse_ts_reference_type(p, context) } } } @@ -794,12 +878,12 @@ fn parse_ts_non_array_type(p: &mut JsParser, context: TypeContext) -> ParsedSynt // type C = A; // type D = B.a; // type E = D.c.b.a; -fn parse_ts_reference_type(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_reference_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { parse_ts_name(p).map(|name| { let m = name.precede(p); if !p.has_preceding_line_break() { - parse_ts_type_arguments(p).ok(); + parse_ts_type_arguments(p, context).ok(); } m.complete(p, TS_REFERENCE_TYPE) @@ -834,7 +918,7 @@ pub(crate) fn parse_ts_name(p: &mut JsParser) -> ParsedSyntax { // test tsx ts_typeof_type2 // type X = typeof Array //
a
; -fn parse_ts_typeof_type(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_typeof_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![typeof]) { return Absent; } @@ -843,7 +927,7 @@ fn parse_ts_typeof_type(p: &mut JsParser) -> ParsedSyntax { p.expect(T![typeof]); parse_ts_name(p).or_add_diagnostic(p, expected_identifier); if !p.has_preceding_line_break() { - parse_ts_type_arguments(p).ok(); + parse_ts_type_arguments(p, context).ok(); } Present(m.complete(p, TS_TYPEOF_TYPE)) @@ -870,14 +954,14 @@ fn parse_ts_this_type(p: &mut JsParser) -> ParsedSyntax { // test ts ts_parenthesized_type // type A = (string) -fn parse_ts_parenthesized_type(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_parenthesized_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T!['(']) { return Absent; } let m = p.start(); p.bump(T!['(']); - parse_ts_type(p, TypeContext::default()).or_add_diagnostic(p, expected_ts_type); + parse_ts_type(p, context).or_add_diagnostic(p, expected_ts_type); p.expect(T![')']); Present(m.complete(p, TS_PARENTHESIZED_TYPE)) } @@ -936,7 +1020,7 @@ fn parse_ts_mapped_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax parse_ts_mapped_type_as_clause(p, context).ok(); p.expect(T![']']); parse_ts_mapped_type_optional_modifier_clause(p).ok(); - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, context).ok(); p.eat(T![;]); p.expect(T!['}']); @@ -992,7 +1076,7 @@ fn parse_ts_mapped_type_optional_modifier_clause(p: &mut JsParser) -> ParsedSynt // type C = typeof import("test").a.b.c.d.e.f; // type D = import("test"); // type E = import("test").C; -fn parse_ts_import_type(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_import_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![typeof]) && !p.at(T![import]) { return Absent; } @@ -1011,7 +1095,7 @@ fn parse_ts_import_type(p: &mut JsParser) -> ParsedSyntax { qualifier.complete(p, TS_IMPORT_TYPE_QUALIFIER); } - parse_ts_type_arguments(p).ok(); + parse_ts_type_arguments(p, context).ok(); Present(m.complete(p, TS_IMPORT_TYPE)) } @@ -1024,19 +1108,28 @@ fn parse_ts_import_type(p: &mut JsParser) -> ParsedSyntax { // a: string // b: number // } -fn parse_ts_object_type(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_object_type(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T!['{']) { return Absent; } let m = p.start(); p.bump(T!['{']); - TypeMembers.parse_list(p); + TypeMembers::new(context).parse_list(p); p.expect(T!['}']); Present(m.complete(p, TS_OBJECT_TYPE)) } -pub(crate) struct TypeMembers; +#[derive(Debug, Default)] +pub(crate) struct TypeMembers { + context: TypeContext, +} + +impl TypeMembers { + pub fn new(context: TypeContext) -> Self { + Self { context } + } +} impl ParseNodeList for TypeMembers { type Kind = JsSyntaxKind; @@ -1045,7 +1138,7 @@ impl ParseNodeList for TypeMembers { const LIST_KIND: Self::Kind = TS_TYPE_MEMBER_LIST; fn parse_element(&mut self, p: &mut JsParser) -> ParsedSyntax { - parse_ts_type_member(p, TypeContext::default()) + parse_ts_type_member(p, self.context) } fn is_at_list_end(&self, p: &mut JsParser) -> bool { @@ -1075,6 +1168,7 @@ fn parse_ts_type_member(p: &mut JsParser, context: TypeContext) -> ParsedSyntax p, m, MemberParent::TypeOrInterface, + context, )); } @@ -1083,8 +1177,12 @@ fn parse_ts_type_member(p: &mut JsParser, context: TypeContext) -> ParsedSyntax T![new] if is_at_ts_construct_signature_type_member(p) => { parse_ts_construct_signature_type_member(p, context) } - T![get] if is_nth_at_type_member_name(p, 1) => parse_ts_getter_signature_type_member(p), - T![set] if is_nth_at_type_member_name(p, 1) => parse_ts_setter_signature_type_member(p), + T![get] if is_nth_at_type_member_name(p, 1) => { + parse_ts_getter_signature_type_member(p, context) + } + T![set] if is_nth_at_type_member_name(p, 1) => { + parse_ts_setter_signature_type_member(p, context) + } _ => parse_ts_property_or_method_signature_type_member(p, context), } } @@ -1130,7 +1228,7 @@ fn parse_ts_property_or_method_signature_type_member( Present(method) } else { - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, context).ok(); parse_ts_type_member_semi(p); Present(m.complete(p, TS_PROPERTY_SIGNATURE_TYPE_MEMBER)) } @@ -1166,9 +1264,14 @@ fn parse_ts_construct_signature_type_member( let m = p.start(); p.expect(T![new]); 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(); + parse_parameter_list( + p, + ParameterContext::Declaration, + context, + SignatureFlags::empty(), + ) + .or_add_diagnostic(p, expected_parameters); + parse_ts_type_annotation(p, context).ok(); parse_ts_type_member_semi(p); Present(m.complete(p, TS_CONSTRUCT_SIGNATURE_TYPE_MEMBER)) @@ -1181,7 +1284,7 @@ fn parse_ts_construct_signature_type_member( // type C = { get(): number } // type D = { get: number } // type E = { get } -fn parse_ts_getter_signature_type_member(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_getter_signature_type_member(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![get]) { return Absent; } @@ -1191,7 +1294,7 @@ fn parse_ts_getter_signature_type_member(p: &mut JsParser) -> ParsedSyntax { parse_object_member_name(p).or_add_diagnostic(p, expected_object_member_name); p.expect(T!['(']); p.expect(T![')']); - parse_ts_type_annotation(p).ok(); + parse_ts_type_annotation(p, context).ok(); parse_ts_type_member_semi(p); Present(m.complete(p, TS_GETTER_SIGNATURE_TYPE_MEMBER)) } @@ -1203,7 +1306,7 @@ fn parse_ts_getter_signature_type_member(p: &mut JsParser) -> ParsedSyntax { // type C = { set(a) } // type D = { set: number } // type E = { set } -fn parse_ts_setter_signature_type_member(p: &mut JsParser) -> ParsedSyntax { +fn parse_ts_setter_signature_type_member(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { if !p.at(T![set]) { return Absent; } @@ -1231,6 +1334,7 @@ fn parse_ts_setter_signature_type_member(p: &mut JsParser) -> ParsedSyntax { decorator_list, ParameterContext::Setter, ExpressionContext::default(), + context, ) .or_add_diagnostic(p, expected_parameter); p.expect(T![')']); @@ -1454,8 +1558,13 @@ fn parse_ts_constructor_type(p: &mut JsParser, context: TypeContext) -> ParsedSy p.expect(T![new]); parse_ts_type_parameters(p, context).ok(); - parse_parameter_list(p, ParameterContext::Declaration, SignatureFlags::empty()) - .or_add_diagnostic(p, expected_parameters); + parse_parameter_list( + p, + ParameterContext::Declaration, + context, + SignatureFlags::empty(), + ) + .or_add_diagnostic(p, expected_parameters); p.expect(T![=>]); parse_ts_type(p, context).or_add_diagnostic(p, expected_ts_type); Present(m.complete(p, TS_CONSTRUCTOR_TYPE)) @@ -1517,10 +1626,16 @@ fn parse_ts_function_type(p: &mut JsParser, context: TypeContext) -> ParsedSynta let m = p.start(); parse_ts_type_parameters(p, context.and_allow_const_modifier(true)).ok(); - parse_parameter_list(p, ParameterContext::Declaration, SignatureFlags::empty()) - .or_add_diagnostic(p, expected_parameters); + parse_parameter_list( + p, + ParameterContext::Declaration, + context, + SignatureFlags::empty(), + ) + .or_add_diagnostic(p, expected_parameters); p.expect(T![=>]); - parse_ts_return_type(p, TypeContext::default()).or_add_diagnostic(p, expected_ts_type); + parse_ts_return_type(p, context.and_allow_conditional_types(true)) + .or_add_diagnostic(p, expected_ts_type); Present(m.complete(p, TS_FUNCTION_TYPE)) } @@ -1840,7 +1955,7 @@ pub(crate) fn parse_ts_type_arguments_in_expression( try_parse(p, |p| { p.re_lex(ReLexContext::TypeArgumentLessThan); - let arguments = parse_ts_type_arguments_impl(p, false); + let arguments = parse_ts_type_arguments_impl(p, TypeContext::default(), false); if p.last() == Some(T![>]) && can_follow_type_arguments_in_expr(p, context) { Ok(Present(arguments)) @@ -1870,7 +1985,7 @@ fn can_follow_type_arguments_in_expr(p: &mut JsParser, context: ExpressionContex } } -pub(crate) fn parse_ts_type_arguments(p: &mut JsParser) -> ParsedSyntax { +pub(crate) fn parse_ts_type_arguments(p: &mut JsParser, context: TypeContext) -> ParsedSyntax { // test ts ts_type_arguments_left_shift // type A = T; // type B = A<(c: C) => undefined>; @@ -1879,13 +1994,14 @@ pub(crate) fn parse_ts_type_arguments(p: &mut JsParser) -> ParsedSyntax { return Absent; } - Present(parse_ts_type_arguments_impl(p, true)) + Present(parse_ts_type_arguments_impl(p, context, true)) } // test_err ts type_arguments_incomplete // func CompletedMarker { let m = p.start(); @@ -1894,15 +2010,25 @@ pub(crate) fn parse_ts_type_arguments_impl( if p.at(T![>]) { p.error(expected_ts_type_parameter(p, p.cur_range())); } - TypeArgumentsList { recover_on_errors }.parse_list(p); + TypeArgumentsList::new(context, recover_on_errors).parse_list(p); p.expect(T![>]); m.complete(p, TS_TYPE_ARGUMENTS) } struct TypeArgumentsList { + context: TypeContext, recover_on_errors: bool, } +impl TypeArgumentsList { + pub(crate) fn new(context: TypeContext, recover_on_errors: bool) -> Self { + Self { + context, + recover_on_errors, + } + } +} + impl ParseSeparatedList for TypeArgumentsList { type Kind = JsSyntaxKind; type Parser<'source> = JsParser<'source>; @@ -1910,7 +2036,7 @@ impl ParseSeparatedList for TypeArgumentsList { const LIST_KIND: Self::Kind = TS_TYPE_ARGUMENT_LIST; fn parse_element(&mut self, p: &mut JsParser) -> ParsedSyntax { - parse_ts_type(p, TypeContext::default()) + parse_ts_type(p, self.context) } fn is_at_list_end(&self, p: &mut JsParser) -> bool { diff --git a/crates/biome_js_parser/src/tests.rs b/crates/biome_js_parser/src/tests.rs index 813f72b791bb..802d6f843dd4 100644 --- a/crates/biome_js_parser/src/tests.rs +++ b/crates/biome_js_parser/src/tests.rs @@ -408,9 +408,7 @@ fn diagnostics_print_correctly() { #[test] pub fn quick_test() { let code = r#" - - - (@dec a) => {} + type A = T extends { get(): infer P } ? P : never "#; let root = parse( code, diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast b/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast new file mode 100644 index 000000000000..69091036e6d4 --- /dev/null +++ b/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast @@ -0,0 +1,1065 @@ +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..18 "WithSelectors" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@18..19 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@19..20 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@20..22 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@22..24 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@24..26 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@34..36 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@36..44 "getState" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@44..46 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@46..47 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@47..49 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@52..58 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@58..60 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + question_mark_token: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsObjectType { + l_curly_token: L_CURLY@66..68 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@68..71 "use" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@71..73 ":" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@73..75 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@75..76 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@76..78 "K" [] [Whitespace(" ")], + }, + in_token: IN_KW@78..81 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@103..104 "T" [] [], + }, + ], + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@104..105 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@105..107 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@107..108 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@108..110 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")], + return_type: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@113..114 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@114..115 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@115..116 "K" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@116..118 "]" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@118..120 "}" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@120..121 "}" [] [], + }, + colon_token: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@126..131 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@131..132 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@138..142 "TV1" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@142..144 "=" [] [Whitespace(" ")], + ty: TsTemplateLiteralType { + l_tick_token: BACKTICK@144..145 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@145..147 "${" [] [], + ty: TsBogusType { + items: [ + INFER_KW@147..153 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@153..154 "X" [] [], + }, + ], + }, + r_curly_token: R_CURLY@154..155 "}" [] [], + }, + ], + r_tick_token: BACKTICK@155..156 "`" [] [], + }, + semicolon_token: SEMICOLON@156..157 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@163..166 "T61" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@166..167 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@167..168 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@168..170 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@170..172 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsParenthesizedType { + l_paren_token: L_PAREN@172..173 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@173..179 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@179..180 "A" [] [], + }, + ], + }, + r_paren_token: R_PAREN@180..182 ")" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@190..196 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@196..198 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@198..200 "?" [] [Whitespace(" ")], + true_type: TsBogusType { + items: [ + INFER_KW@200..206 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@206..208 "C" [] [Whitespace(" ")], + }, + ], + }, + colon_token: COLON@208..210 ":" [] [Whitespace(" ")], + false_type: TsBogusType { + items: [ + INFER_KW@210..216 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@216..217 "D" [] [], + }, + ], + }, + }, + semicolon_token: SEMICOLON@217..218 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@224..226 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@226..228 "=" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@228..229 "{" [] [], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@229..230 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@230..232 ":" [] [Whitespace(" ")], + ty: TsBogusType { + items: [ + INFER_KW@232..238 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@238..239 "T" [] [], + }, + ], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@239..240 "}" [] [], + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@246..248 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@248..250 "=" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@250..251 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@251..253 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")], + return_type: TsBogusType { + items: [ + INFER_KW@256..262 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@262..263 "T" [] [], + }, + ], + }, + }, + semicolon_token: SEMICOLON@263..264 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@269..270 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@270..272 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@272..273 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@273..279 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@279..285 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@285..286 ")" [] [], + }, + l_brack_token: L_BRACK@286..287 "[" [] [], + r_brack_token: R_BRACK@287..289 "]" [] [Whitespace(" ")], + }, + }, + initializer: JsInitializerClause { + eq_token: EQ@289..291 "=" [] [Whitespace(" ")], + expression: JsCallExpression { + callee: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@291..297 "symbol" [] [], + }, + }, + optional_chain_token: missing (optional), + type_arguments: missing (optional), + arguments: JsCallArguments { + l_paren_token: L_PAREN@297..298 "(" [] [], + args: JsCallArgumentList [], + r_paren_token: R_PAREN@298..299 ")" [] [], + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@299..300 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@305..306 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@306..308 ":" [] [Whitespace(" ")], + ty: TsTypeOperatorType { + operator_token: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")], + ty: TsParenthesizedType { + l_paren_token: L_PAREN@315..316 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@316..322 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@322..328 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@328..329 ")" [] [], + }, + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: SEMICOLON@329..330 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@335..336 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@336..338 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@338..339 "[" [] [], + elements: TsTupleTypeElementList [ + TsNumberType { + number_token: NUMBER_KW@339..345 "number" [] [], + }, + COMMA@345..347 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@347..350 "..." [] [], + ty: TsBogusType { + items: [ + INFER_KW@350..356 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@356..362 "string" [] [], + }, + ], + }, + }, + ], + r_brack_token: R_BRACK@362..363 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@368..369 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@369..371 ":" [] [Whitespace(" ")], + ty: TsTupleType { + l_brack_token: L_BRACK@371..372 "[" [] [], + elements: TsTupleTypeElementList [ + TsOptionalTupleTypeElement { + ty: TsParenthesizedType { + l_paren_token: L_PAREN@372..373 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@373..379 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@379..385 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@385..386 ")" [] [], + }, + question_mark_token: QUESTION@386..387 "?" [] [], + }, + ], + r_brack_token: R_BRACK@387..388 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@393..394 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@394..396 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsParenthesizedType { + l_paren_token: L_PAREN@396..397 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@397..403 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@403..409 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@409..410 ")" [] [], + }, + l_brack_token: L_BRACK@410..411 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@411..412 "a" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@412..413 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@418..419 "s" [] [], + }, + variable_annotation: TsTypeAnnotation { + colon_token: COLON@419..421 ":" [] [Whitespace(" ")], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@421..422 "a" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@422..423 "[" [] [], + index_type: TsParenthesizedType { + l_paren_token: L_PAREN@423..424 "(" [] [], + ty: TsBogusType { + items: [ + INFER_KW@424..430 "infer" [] [Whitespace(" ")], + TsTypeParameterName { + ident_token: IDENT@430..436 "string" [] [], + }, + ], + }, + r_paren_token: R_PAREN@436..437 ")" [] [], + }, + r_brack_token: R_BRACK@437..438 "]" [] [], + }, + }, + initializer: missing (optional), + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + eof_token: EOF@438..439 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..439 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..438 + 0: TS_TYPE_ALIAS_DECLARATION@0..132 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..18 + 0: IDENT@5..18 "WithSelectors" [] [] + 2: TS_TYPE_PARAMETERS@18..22 + 0: L_ANGLE@18..19 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@19..20 + 0: TS_TYPE_PARAMETER@19..20 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@19..19 + 1: TS_TYPE_PARAMETER_NAME@19..20 + 0: IDENT@19..20 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@20..22 ">" [] [Whitespace(" ")] + 3: EQ@22..24 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@24..131 + 0: TS_REFERENCE_TYPE@24..26 + 0: JS_REFERENCE_IDENTIFIER@24..26 + 0: IDENT@24..26 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@26..34 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@34..61 + 0: L_CURLY@34..36 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@36..60 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@36..60 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@36..44 + 0: IDENT@36..44 "getState" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@44..60 + 0: COLON@44..46 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@46..60 + 0: (empty) + 1: JS_PARAMETERS@46..49 + 0: L_PAREN@46..47 "(" [] [] + 1: JS_PARAMETER_LIST@47..47 + 2: R_PAREN@47..49 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@49..52 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@52..60 + 0: INFER_KW@52..58 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@58..60 + 0: IDENT@58..60 "T" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@60..61 "}" [] [] + 3: QUESTION@61..66 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@66..121 + 0: L_CURLY@66..68 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@68..120 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@68..120 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@68..71 + 0: IDENT@68..71 "use" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@71..120 + 0: COLON@71..73 ":" [] [Whitespace(" ")] + 1: TS_MAPPED_TYPE@73..120 + 0: L_CURLY@73..75 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@75..76 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@76..78 + 0: IDENT@76..78 "K" [] [Whitespace(" ")] + 4: IN_KW@78..81 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@81..104 + 0: KEYOF_KW@81..87 "keyof" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@87..104 + 0: INFER_KW@87..103 "infer" [] [Whitespace(" "), Comments("/*error*/"), Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@103..104 + 0: IDENT@103..104 "T" [] [] + 6: (empty) + 7: R_BRACK@104..105 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@105..118 + 0: COLON@105..107 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@107..118 + 0: (empty) + 1: JS_PARAMETERS@107..110 + 0: L_PAREN@107..108 "(" [] [] + 1: JS_PARAMETER_LIST@108..108 + 2: R_PAREN@108..110 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@110..113 "=>" [] [Whitespace(" ")] + 3: TS_INDEXED_ACCESS_TYPE@113..118 + 0: TS_REFERENCE_TYPE@113..114 + 0: JS_REFERENCE_IDENTIFIER@113..114 + 0: IDENT@113..114 "T" [] [] + 1: (empty) + 1: L_BRACK@114..115 "[" [] [] + 2: TS_REFERENCE_TYPE@115..116 + 0: JS_REFERENCE_IDENTIFIER@115..116 + 0: IDENT@115..116 "K" [] [] + 1: (empty) + 3: R_BRACK@116..118 "]" [] [Whitespace(" ")] + 10: (empty) + 11: R_CURLY@118..120 "}" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@120..121 "}" [] [] + 5: COLON@121..126 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_NEVER_TYPE@126..131 + 0: NEVER_KW@126..131 "never" [] [] + 5: SEMICOLON@131..132 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@132..157 + 0: TYPE_KW@132..138 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@138..142 + 0: IDENT@138..142 "TV1" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@142..144 "=" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@144..156 + 0: BACKTICK@144..145 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@145..155 + 0: TS_TEMPLATE_ELEMENT@145..155 + 0: DOLLAR_CURLY@145..147 "${" [] [] + 1: TS_BOGUS_TYPE@147..154 + 0: INFER_KW@147..153 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@153..154 + 0: IDENT@153..154 "X" [] [] + 2: R_CURLY@154..155 "}" [] [] + 2: BACKTICK@155..156 "`" [] [] + 5: SEMICOLON@156..157 ";" [] [] + 2: TS_TYPE_ALIAS_DECLARATION@157..218 + 0: TYPE_KW@157..163 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@163..166 + 0: IDENT@163..166 "T61" [] [] + 2: TS_TYPE_PARAMETERS@166..170 + 0: L_ANGLE@166..167 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@167..168 + 0: TS_TYPE_PARAMETER@167..168 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@167..167 + 1: TS_TYPE_PARAMETER_NAME@167..168 + 0: IDENT@167..168 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@168..170 ">" [] [Whitespace(" ")] + 3: EQ@170..172 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@172..217 + 0: TS_PARENTHESIZED_TYPE@172..182 + 0: L_PAREN@172..173 "(" [] [] + 1: TS_BOGUS_TYPE@173..180 + 0: INFER_KW@173..179 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@179..180 + 0: IDENT@179..180 "A" [] [] + 2: R_PAREN@180..182 ")" [] [Whitespace(" ")] + 1: EXTENDS_KW@182..190 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@190..198 + 0: INFER_KW@190..196 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@196..198 + 0: IDENT@196..198 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@198..200 "?" [] [Whitespace(" ")] + 4: TS_BOGUS_TYPE@200..208 + 0: INFER_KW@200..206 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@206..208 + 0: IDENT@206..208 "C" [] [Whitespace(" ")] + 5: COLON@208..210 ":" [] [Whitespace(" ")] + 6: TS_BOGUS_TYPE@210..217 + 0: INFER_KW@210..216 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@216..217 + 0: IDENT@216..217 "D" [] [] + 5: SEMICOLON@217..218 ";" [] [] + 3: TS_TYPE_ALIAS_DECLARATION@218..240 + 0: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@224..226 + 0: IDENT@224..226 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@226..228 "=" [] [Whitespace(" ")] + 4: TS_OBJECT_TYPE@228..240 + 0: L_CURLY@228..229 "{" [] [] + 1: TS_TYPE_MEMBER_LIST@229..239 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@229..239 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@229..230 + 0: IDENT@229..230 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@230..239 + 0: COLON@230..232 ":" [] [Whitespace(" ")] + 1: TS_BOGUS_TYPE@232..239 + 0: INFER_KW@232..238 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@238..239 + 0: IDENT@238..239 "T" [] [] + 4: (empty) + 2: R_CURLY@239..240 "}" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@240..264 + 0: TYPE_KW@240..246 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@246..248 + 0: IDENT@246..248 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@248..250 "=" [] [Whitespace(" ")] + 4: TS_FUNCTION_TYPE@250..263 + 0: (empty) + 1: JS_PARAMETERS@250..253 + 0: L_PAREN@250..251 "(" [] [] + 1: JS_PARAMETER_LIST@251..251 + 2: R_PAREN@251..253 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@253..256 "=>" [] [Whitespace(" ")] + 3: TS_BOGUS_TYPE@256..263 + 0: INFER_KW@256..262 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@262..263 + 0: IDENT@262..263 "T" [] [] + 5: SEMICOLON@263..264 ";" [] [] + 5: JS_VARIABLE_STATEMENT@264..300 + 0: JS_VARIABLE_DECLARATION@264..299 + 0: (empty) + 1: LET_KW@264..269 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@269..299 + 0: JS_VARIABLE_DECLARATOR@269..299 + 0: JS_IDENTIFIER_BINDING@269..270 + 0: IDENT@269..270 "s" [] [] + 1: TS_TYPE_ANNOTATION@270..289 + 0: COLON@270..272 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@272..289 + 0: TS_PARENTHESIZED_TYPE@272..286 + 0: L_PAREN@272..273 "(" [] [] + 1: TS_BOGUS_TYPE@273..285 + 0: INFER_KW@273..279 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@279..285 + 0: IDENT@279..285 "string" [] [] + 2: R_PAREN@285..286 ")" [] [] + 1: L_BRACK@286..287 "[" [] [] + 2: R_BRACK@287..289 "]" [] [Whitespace(" ")] + 2: JS_INITIALIZER_CLAUSE@289..299 + 0: EQ@289..291 "=" [] [Whitespace(" ")] + 1: JS_CALL_EXPRESSION@291..299 + 0: JS_IDENTIFIER_EXPRESSION@291..297 + 0: JS_REFERENCE_IDENTIFIER@291..297 + 0: IDENT@291..297 "symbol" [] [] + 1: (empty) + 2: (empty) + 3: JS_CALL_ARGUMENTS@297..299 + 0: L_PAREN@297..298 "(" [] [] + 1: JS_CALL_ARGUMENT_LIST@298..298 + 2: R_PAREN@298..299 ")" [] [] + 1: SEMICOLON@299..300 ";" [] [] + 6: JS_VARIABLE_STATEMENT@300..330 + 0: JS_VARIABLE_DECLARATION@300..329 + 0: (empty) + 1: LET_KW@300..305 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@305..329 + 0: JS_VARIABLE_DECLARATOR@305..329 + 0: JS_IDENTIFIER_BINDING@305..306 + 0: IDENT@305..306 "s" [] [] + 1: TS_TYPE_ANNOTATION@306..329 + 0: COLON@306..308 ":" [] [Whitespace(" ")] + 1: TS_TYPE_OPERATOR_TYPE@308..329 + 0: UNIQUE_KW@308..315 "unique" [] [Whitespace(" ")] + 1: TS_PARENTHESIZED_TYPE@315..329 + 0: L_PAREN@315..316 "(" [] [] + 1: TS_BOGUS_TYPE@316..328 + 0: INFER_KW@316..322 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@322..328 + 0: IDENT@322..328 "string" [] [] + 2: R_PAREN@328..329 ")" [] [] + 2: (empty) + 1: SEMICOLON@329..330 ";" [] [] + 7: JS_VARIABLE_STATEMENT@330..363 + 0: JS_VARIABLE_DECLARATION@330..363 + 0: (empty) + 1: LET_KW@330..335 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@335..363 + 0: JS_VARIABLE_DECLARATOR@335..363 + 0: JS_IDENTIFIER_BINDING@335..336 + 0: IDENT@335..336 "s" [] [] + 1: TS_TYPE_ANNOTATION@336..363 + 0: COLON@336..338 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@338..363 + 0: L_BRACK@338..339 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@339..362 + 0: TS_NUMBER_TYPE@339..345 + 0: NUMBER_KW@339..345 "number" [] [] + 1: COMMA@345..347 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@347..362 + 0: DOT3@347..350 "..." [] [] + 1: TS_BOGUS_TYPE@350..362 + 0: INFER_KW@350..356 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@356..362 + 0: IDENT@356..362 "string" [] [] + 2: R_BRACK@362..363 "]" [] [] + 2: (empty) + 1: (empty) + 8: JS_VARIABLE_STATEMENT@363..388 + 0: JS_VARIABLE_DECLARATION@363..388 + 0: (empty) + 1: LET_KW@363..368 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@368..388 + 0: JS_VARIABLE_DECLARATOR@368..388 + 0: JS_IDENTIFIER_BINDING@368..369 + 0: IDENT@368..369 "s" [] [] + 1: TS_TYPE_ANNOTATION@369..388 + 0: COLON@369..371 ":" [] [Whitespace(" ")] + 1: TS_TUPLE_TYPE@371..388 + 0: L_BRACK@371..372 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@372..387 + 0: TS_OPTIONAL_TUPLE_TYPE_ELEMENT@372..387 + 0: TS_PARENTHESIZED_TYPE@372..386 + 0: L_PAREN@372..373 "(" [] [] + 1: TS_BOGUS_TYPE@373..385 + 0: INFER_KW@373..379 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@379..385 + 0: IDENT@379..385 "string" [] [] + 2: R_PAREN@385..386 ")" [] [] + 1: QUESTION@386..387 "?" [] [] + 2: R_BRACK@387..388 "]" [] [] + 2: (empty) + 1: (empty) + 9: JS_VARIABLE_STATEMENT@388..413 + 0: JS_VARIABLE_DECLARATION@388..413 + 0: (empty) + 1: LET_KW@388..393 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@393..413 + 0: JS_VARIABLE_DECLARATOR@393..413 + 0: JS_IDENTIFIER_BINDING@393..394 + 0: IDENT@393..394 "s" [] [] + 1: TS_TYPE_ANNOTATION@394..413 + 0: COLON@394..396 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@396..413 + 0: TS_PARENTHESIZED_TYPE@396..410 + 0: L_PAREN@396..397 "(" [] [] + 1: TS_BOGUS_TYPE@397..409 + 0: INFER_KW@397..403 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@403..409 + 0: IDENT@403..409 "string" [] [] + 2: R_PAREN@409..410 ")" [] [] + 1: L_BRACK@410..411 "[" [] [] + 2: TS_REFERENCE_TYPE@411..412 + 0: JS_REFERENCE_IDENTIFIER@411..412 + 0: IDENT@411..412 "a" [] [] + 1: (empty) + 3: R_BRACK@412..413 "]" [] [] + 2: (empty) + 1: (empty) + 10: JS_VARIABLE_STATEMENT@413..438 + 0: JS_VARIABLE_DECLARATION@413..438 + 0: (empty) + 1: LET_KW@413..418 "let" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@418..438 + 0: JS_VARIABLE_DECLARATOR@418..438 + 0: JS_IDENTIFIER_BINDING@418..419 + 0: IDENT@418..419 "s" [] [] + 1: TS_TYPE_ANNOTATION@419..438 + 0: COLON@419..421 ":" [] [Whitespace(" ")] + 1: TS_INDEXED_ACCESS_TYPE@421..438 + 0: TS_REFERENCE_TYPE@421..422 + 0: JS_REFERENCE_IDENTIFIER@421..422 + 0: IDENT@421..422 "a" [] [] + 1: (empty) + 1: L_BRACK@422..423 "[" [] [] + 2: TS_PARENTHESIZED_TYPE@423..437 + 0: L_PAREN@423..424 "(" [] [] + 1: TS_BOGUS_TYPE@424..436 + 0: INFER_KW@424..430 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@430..436 + 0: IDENT@430..436 "string" [] [] + 2: R_PAREN@436..437 ")" [] [] + 3: R_BRACK@437..438 "]" [] [] + 2: (empty) + 1: (empty) + 3: EOF@438..439 "" [Newline("\n")] [] +-- +ts_infer_type_not_allowed.ts:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 1 │ type WithSelectors = S extends { getState: () => infer T } + > 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + │ ^^^^^^^^^^^^^^^^^ + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + +-- +ts_infer_type_not_allowed.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 2 │ ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + 3 │ : never; + > 4 │ type TV1 = `${infer X}`; + │ ^^^^^^^ + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + 6 │ type A = {a: infer T} + +-- +ts_infer_type_not_allowed.ts:5:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +-- +ts_infer_type_not_allowed.ts:5:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +-- +ts_infer_type_not_allowed.ts:5:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 3 │ : never; + 4 │ type TV1 = `${infer X}`; + > 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + │ ^^^^^^^ + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + +-- +ts_infer_type_not_allowed.ts:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 4 │ type TV1 = `${infer X}`; + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + > 6 │ type A = {a: infer T} + │ ^^^^^^^ + 7 │ type A = () => infer T; + 8 │ let s: (infer string)[] = symbol(); + +-- +ts_infer_type_not_allowed.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; + 6 │ type A = {a: infer T} + > 7 │ type A = () => infer T; + │ ^^^^^^^ + 8 │ let s: (infer string)[] = symbol(); + 9 │ let s: unique (infer string); + +-- +ts_infer_type_not_allowed.ts:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 6 │ type A = {a: infer T} + 7 │ type A = () => infer T; + > 8 │ let s: (infer string)[] = symbol(); + │ ^^^^^^^^^^^^ + 9 │ let s: unique (infer string); + 10 │ let s: [number, ...infer string] + +-- +ts_infer_type_not_allowed.ts:9:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 7 │ type A = () => infer T; + 8 │ let s: (infer string)[] = symbol(); + > 9 │ let s: unique (infer string); + │ ^^^^^^^^^^^^ + 10 │ let s: [number, ...infer string] + 11 │ let s: [(infer string)?] + +-- +ts_infer_type_not_allowed.ts:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 8 │ let s: (infer string)[] = symbol(); + 9 │ let s: unique (infer string); + > 10 │ let s: [number, ...infer string] + │ ^^^^^^^^^^^^ + 11 │ let s: [(infer string)?] + 12 │ let s: (infer string)[a] + +-- +ts_infer_type_not_allowed.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 9 │ let s: unique (infer string); + 10 │ let s: [number, ...infer string] + > 11 │ let s: [(infer string)?] + │ ^^^^^^^^^^^^ + 12 │ let s: (infer string)[a] + 13 │ let s: a[(infer string)] + +-- +ts_infer_type_not_allowed.ts:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 10 │ let s: [number, ...infer string] + 11 │ let s: [(infer string)?] + > 12 │ let s: (infer string)[a] + │ ^^^^^^^^^^^^ + 13 │ let s: a[(infer string)] + 14 │ + +-- +ts_infer_type_not_allowed.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. + + 11 │ let s: [(infer string)?] + 12 │ let s: (infer string)[a] + > 13 │ let s: a[(infer string)] + │ ^^^^^^^^^^^^ + 14 │ + +-- +type WithSelectors = S extends { getState: () => infer T } + ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + : never; +type TV1 = `${infer X}`; +type T61 = (infer A) extends infer B ? infer C : infer D; +type A = {a: infer T} +type A = () => infer T; +let s: (infer string)[] = symbol(); +let s: unique (infer string); +let s: [number, ...infer string] +let s: [(infer string)?] +let s: (infer string)[a] +let s: a[(infer string)] diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts b/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts new file mode 100644 index 000000000000..cbb1fdbf12d3 --- /dev/null +++ b/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts @@ -0,0 +1,13 @@ +type WithSelectors = S extends { getState: () => infer T } + ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + : never; +type TV1 = `${infer X}`; +type T61 = (infer A) extends infer B ? infer C : infer D; +type A = {a: infer T} +type A = () => infer T; +let s: (infer string)[] = symbol(); +let s: unique (infer string); +let s: [number, ...infer string] +let s: [(infer string)?] +let s: (infer string)[a] +let s: a[(infer string)] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast b/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast new file mode 100644 index 000000000000..8fafa76ce026 --- /dev/null +++ b/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast @@ -0,0 +1,3755 @@ +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..7 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@7..9 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@9..11 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], + extends_type: TsImportType { + typeof_token: missing (optional), + import_token: IMPORT_KW@19..25 "import" [] [], + l_paren_token: L_PAREN@25..26 "(" [] [], + argument_token: JS_STRING_LITERAL@26..32 "\"test\"" [] [], + r_paren_token: R_PAREN@32..33 ")" [] [], + qualifier_clause: TsImportTypeQualifier { + dot_token: DOT@33..34 "." [] [], + right: JsReferenceIdentifier { + value_token: IDENT@34..35 "C" [] [], + }, + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@35..36 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@36..42 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@42..43 "P" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@43..45 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@45..47 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@47..49 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@49..51 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@51..56 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@62..64 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@64..66 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@66..68 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@68..76 "extends" [] [Whitespace(" ")], + extends_type: TsTypeofType { + typeof_token: TYPEOF_KW@76..83 "typeof" [] [Whitespace(" ")], + expression_name: JsReferenceIdentifier { + value_token: IDENT@83..88 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@88..89 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@89..95 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@95..96 "P" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@96..98 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@98..100 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@100..102 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@102..104 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@104..109 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@109..115 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@115..117 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@117..119 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@119..121 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@121..129 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@129..131 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@131..134 "set" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@134..135 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@135..136 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@136..138 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@138..144 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@144..145 "P" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@145..146 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@146..148 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@148..155 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@155..157 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@157..159 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@159..161 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@161..163 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@163..168 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@174..176 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@176..178 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@178..180 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@180..188 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@188..190 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@190..193 "get" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@193..194 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@194..195 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@195..197 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@197..203 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@203..205 "P" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@205..207 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@207..209 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@209..211 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@211..213 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@213..218 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@224..226 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@226..228 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@228..230 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@230..238 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@238..240 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@240..246 "method" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@246..247 "(" [] [], + items: JsParameterList [ + TsThisParameter { + this_token: THIS_KW@247..251 "this" [] [], + type_annotation: TsTypeAnnotation { + colon_token: COLON@251..253 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@253..259 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@259..260 "P" [] [], + }, + constraint: missing (optional), + }, + }, + }, + ], + r_paren_token: R_PAREN@260..261 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@261..263 ":" [] [Whitespace(" ")], + ty: TsNumberType { + number_token: NUMBER_KW@263..270 "number" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@270..272 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@272..274 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@274..276 "P" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@276..278 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@278..283 "never" [] [], + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@289..295 "valid9" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@295..296 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@296..297 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@297..299 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@299..301 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@301..303 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@303..311 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@311..316 "Array" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@316..317 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@317..323 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@323..324 "R" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@324..326 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@326..328 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@328..330 "R" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@330..332 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@332..335 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@335..336 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@336..342 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@342..364 "ContentBetweenBrackets" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@364..365 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@365..366 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@366..368 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@368..370 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@370..372 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@372..380 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@380..381 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@381..382 "[" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@382..384 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@384..390 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@390..391 "T" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@391..392 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@392..393 "]" [] [], + }, + ], + r_tick_token: BACKTICK@393..395 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@395..397 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@397..399 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@399..401 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@401..406 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@406..407 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@407..413 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@413..426 "WithSelectors" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@426..427 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@427..428 "S" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@428..430 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@430..432 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@432..434 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@442..444 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@444..452 "getState" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@452..454 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@454..455 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@455..457 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@457..460 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@460..466 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@466..468 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@468..469 "}" [] [], + }, + question_mark_token: QUESTION@469..476 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + true_type: TsIntersectionType { + leading_separator_token: missing (optional), + types: TsIntersectionTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@476..478 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + AMP@478..480 "&" [] [Whitespace(" ")], + TsObjectType { + l_curly_token: L_CURLY@480..482 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@482..485 "use" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@485..487 ":" [] [Whitespace(" ")], + ty: TsMappedType { + l_curly_token: L_CURLY@487..489 "{" [] [Whitespace(" ")], + readonly_modifier: missing (optional), + l_brack_token: L_BRACK@489..490 "[" [] [], + property_name: TsTypeParameterName { + ident_token: IDENT@490..492 "K" [] [Whitespace(" ")], + }, + in_token: IN_KW@492..495 "in" [] [Whitespace(" ")], + keys_type: TsTypeOperatorType { + operator_token: KEYOF_KW@495..501 "keyof" [] [Whitespace(" ")], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@501..502 "T" [] [], + }, + type_arguments: missing (optional), + }, + }, + as_clause: missing (optional), + r_brack_token: R_BRACK@502..503 "]" [] [], + optional_modifier: missing (optional), + mapped_type: TsTypeAnnotation { + colon_token: COLON@503..505 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@505..506 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@506..508 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@508..511 "=>" [] [Whitespace(" ")], + return_type: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@511..512 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@512..513 "[" [] [], + index_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@513..514 "K" [] [], + }, + type_arguments: missing (optional), + }, + r_brack_token: R_BRACK@514..516 "]" [] [Whitespace(" ")], + }, + }, + }, + semicolon_token: missing (optional), + r_curly_token: R_CURLY@516..518 "}" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@518..519 "}" [] [], + }, + ], + }, + colon_token: COLON@519..526 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@526..531 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@531..532 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@532..538 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@538..540 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + eq_token: EQ@540..542 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@542..549 "MyType" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@549..557 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@557..558 "(" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@558..568 "OtherType" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@568..576 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@576..582 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@582..584 "T" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@584..586 "?" [] [Whitespace(" ")], + true_type: TsInferType { + infer_token: INFER_KW@586..592 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@592..594 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + colon_token: COLON@594..596 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@596..606 "InnerFalse" [] [], + }, + type_arguments: missing (optional), + }, + }, + r_paren_token: R_PAREN@606..608 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@608..610 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@610..620 "OuterTrue" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@620..622 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@622..632 "OuterFalse" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: missing (optional), + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@632..638 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@638..642 "Join" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@642..643 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@643..645 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@645..653 "extends" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsUnknownType { + unknown_token: UNKNOWN_KW@653..660 "unknown" [] [], + }, + l_brack_token: L_BRACK@660..661 "[" [] [], + r_brack_token: R_BRACK@661..662 "]" [] [], + }, + }, + default: missing (optional), + }, + COMMA@662..664 "," [] [Whitespace(" ")], + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@664..666 "D" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@666..674 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@674..680 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@680..682 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@682..683 "=" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@683..691 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@691..699 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@699..700 "[" [] [], + elements: TsTupleTypeElementList [], + r_brack_token: R_BRACK@700..702 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@702..704 "?" [] [Whitespace(" ")], + true_type: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@704..707 "''" [] [Whitespace(" ")], + }, + colon_token: COLON@707..708 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@708..716 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@716..724 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@724..725 "[" [] [], + elements: TsTupleTypeElementList [ + TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@725..732 "string" [] [Whitespace(" ")], + }, + PIPE@732..734 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@734..741 "number" [] [Whitespace(" ")], + }, + PIPE@741..743 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@743..751 "boolean" [] [Whitespace(" ")], + }, + PIPE@751..753 "|" [] [Whitespace(" ")], + TsBigintType { + bigint_token: BIGINT_KW@753..759 "bigint" [] [], + }, + ], + }, + ], + r_brack_token: R_BRACK@759..761 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@761..763 "?" [] [Whitespace(" ")], + true_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@763..764 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@764..766 "${" [] [], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@766..767 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@767..768 "[" [] [], + index_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@768..769 "0" [] [], + }, + r_brack_token: R_BRACK@769..770 "]" [] [], + }, + r_curly_token: R_CURLY@770..771 "}" [] [], + }, + ], + r_tick_token: BACKTICK@771..773 "`" [] [Whitespace(" ")], + }, + colon_token: COLON@773..774 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@774..782 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@782..790 "extends" [] [Whitespace(" ")], + extends_type: TsTupleType { + l_brack_token: L_BRACK@790..791 "[" [] [], + elements: TsTupleTypeElementList [ + TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@791..798 "string" [] [Whitespace(" ")], + }, + PIPE@798..800 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@800..807 "number" [] [Whitespace(" ")], + }, + PIPE@807..809 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@809..817 "boolean" [] [Whitespace(" ")], + }, + PIPE@817..819 "|" [] [Whitespace(" ")], + TsBigintType { + bigint_token: BIGINT_KW@819..825 "bigint" [] [], + }, + ], + }, + COMMA@825..827 "," [] [Whitespace(" ")], + TsRestTupleTypeElement { + dotdotdot_token: DOT3@827..830 "..." [] [], + ty: TsInferType { + infer_token: INFER_KW@830..836 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@836..837 "U" [] [], + }, + constraint: missing (optional), + }, + }, + ], + r_brack_token: R_BRACK@837..839 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@839..841 "?" [] [Whitespace(" ")], + true_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@841..842 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@842..844 "${" [] [], + ty: TsIndexedAccessType { + object_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@844..845 "T" [] [], + }, + type_arguments: missing (optional), + }, + l_brack_token: L_BRACK@845..846 "[" [] [], + index_type: TsNumberLiteralType { + minus_token: missing (optional), + literal_token: JS_NUMBER_LITERAL@846..847 "0" [] [], + }, + r_brack_token: R_BRACK@847..848 "]" [] [], + }, + r_curly_token: R_CURLY@848..849 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@849..851 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@851..852 "D" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@852..853 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@853..855 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@855..859 "Join" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@859..860 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@860..861 "U" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@861..863 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@863..864 "D" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@864..865 ">" [] [], + }, + }, + r_curly_token: R_CURLY@865..866 "}" [] [], + }, + ], + r_tick_token: BACKTICK@866..868 "`" [] [Whitespace(" ")], + }, + colon_token: COLON@868..869 ":" [] [], + false_type: TsStringType { + string_token: STRING_KW@869..881 "string" [Newline("\n"), Whitespace(" ")] [], + }, + }, + }, + }, + semicolon_token: SEMICOLON@881..882 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@882..888 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@888..897 "MatchPair" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@897..898 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@898..900 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@900..908 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@908..914 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@914..916 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@916..918 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@918..920 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@920..928 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@928..929 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@929..930 "[" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@930..932 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@932..938 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@938..939 "A" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@939..940 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@940..941 "," [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@941..943 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@943..949 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@949..950 "B" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@950..951 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@951..952 "]" [] [], + }, + ], + r_tick_token: BACKTICK@952..954 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@954..956 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@956..957 "[" [] [], + elements: TsTupleTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@957..958 "A" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@958..960 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@960..961 "B" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@961..963 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@963..965 ":" [] [Whitespace(" ")], + false_type: TsUnknownType { + unknown_token: UNKNOWN_KW@965..972 "unknown" [] [], + }, + }, + semicolon_token: SEMICOLON@972..973 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@973..979 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@979..994 "FirstTwoAndRest" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@994..995 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@995..997 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@997..1005 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@1005..1011 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1011..1013 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1013..1015 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1015..1017 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1017..1025 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1025..1026 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1026..1028 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1028..1034 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1034..1035 "A" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1035..1036 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1036..1038 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1038..1044 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1044..1045 "B" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1045..1046 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1046..1048 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1048..1054 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1054..1055 "R" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1055..1056 "}" [] [], + }, + ], + r_tick_token: BACKTICK@1056..1058 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1058..1060 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@1060..1061 "[" [] [], + elements: TsTupleTypeElementList [ + TsTemplateLiteralType { + l_tick_token: BACKTICK@1061..1062 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1062..1064 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1064..1065 "A" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@1065..1066 "}" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1066..1068 "${" [] [], + ty: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1068..1069 "B" [] [], + }, + type_arguments: missing (optional), + }, + r_curly_token: R_CURLY@1069..1070 "}" [] [], + }, + ], + r_tick_token: BACKTICK@1070..1071 "`" [] [], + }, + COMMA@1071..1073 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1073..1074 "R" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@1074..1076 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@1076..1078 ":" [] [Whitespace(" ")], + false_type: TsUnknownType { + unknown_token: UNKNOWN_KW@1078..1085 "unknown" [] [], + }, + }, + semicolon_token: SEMICOLON@1085..1086 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1086..1092 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1092..1096 "Trim" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1096..1097 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1097..1099 "S" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1099..1107 "extends" [] [Whitespace(" ")], + ty: TsStringType { + string_token: STRING_KW@1107..1113 "string" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1113..1115 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1115..1116 "=" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1116..1124 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1124..1132 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1132..1133 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1133..1135 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1135..1141 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1141..1142 "T" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1142..1143 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1143..1144 " " [] [], + }, + ], + r_tick_token: BACKTICK@1144..1146 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1146..1148 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1148..1152 "Trim" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1152..1153 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1153..1154 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1154..1156 ">" [] [Whitespace(" ")], + }, + }, + colon_token: COLON@1156..1157 ":" [] [], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1157..1164 "S" [Newline("\n"), Whitespace(" ")] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@1164..1165 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1165..1171 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1171..1174 "Foo" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1174..1175 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1175..1176 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1176..1178 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1178..1180 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1180..1182 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1182..1190 "extends" [] [Whitespace(" ")], + extends_type: TsTemplateLiteralType { + l_tick_token: BACKTICK@1190..1191 "`" [] [], + elements: TsTemplateElementList [ + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1191..1192 "*" [] [], + }, + TsTemplateElement { + dollar_curly_token: DOLLAR_CURLY@1192..1194 "${" [] [], + ty: TsInferType { + infer_token: INFER_KW@1194..1200 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1200..1201 "S" [] [], + }, + constraint: missing (optional), + }, + r_curly_token: R_CURLY@1201..1202 "}" [] [], + }, + TsTemplateChunkElement { + template_chunk_token: TEMPLATE_CHUNK@1202..1203 "*" [] [], + }, + ], + r_tick_token: BACKTICK@1203..1205 "`" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1205..1207 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1207..1209 "S" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1209..1211 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1211..1216 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1216..1217 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1217..1223 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1223..1231 "Unpacked" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1231..1232 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1232..1233 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1233..1235 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1235..1237 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1237..1239 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1239..1247 "extends" [] [Whitespace(" ")], + extends_type: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@1247..1248 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1248..1254 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1254..1255 "U" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1255..1256 ")" [] [], + }, + l_brack_token: L_BRACK@1256..1257 "[" [] [], + r_brack_token: R_BRACK@1257..1259 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1259..1261 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1261..1263 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1263..1264 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1264..1271 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1271..1279 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1279..1280 "(" [] [], + items: JsParameterList [ + JsRestParameter { + decorators: JsDecoratorList [], + dotdotdot_token: DOT3@1280..1283 "..." [] [], + binding: JsIdentifierBinding { + name_token: IDENT@1283..1287 "args" [] [], + }, + type_annotation: TsTypeAnnotation { + colon_token: COLON@1287..1289 ":" [] [Whitespace(" ")], + ty: TsArrayType { + element_type: TsAnyType { + any_token: ANY_KW@1289..1292 "any" [] [], + }, + l_brack_token: L_BRACK@1292..1293 "[" [] [], + r_brack_token: R_BRACK@1293..1294 "]" [] [], + }, + }, + }, + ], + r_paren_token: R_PAREN@1294..1296 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1296..1299 "=>" [] [Whitespace(" ")], + return_type: TsInferType { + infer_token: INFER_KW@1299..1305 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1305..1307 "U" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + question_mark_token: QUESTION@1307..1309 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1309..1311 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1311..1312 ":" [] [], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1312..1319 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1319..1327 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1327..1334 "Promise" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1334..1335 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@1335..1341 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1341..1342 "U" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1342..1344 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1344..1346 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1346..1348 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1348..1349 ":" [] [], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1349..1355 "T" [Newline("\n"), Whitespace(" ")] [], + }, + type_arguments: missing (optional), + }, + }, + }, + }, + semicolon_token: SEMICOLON@1355..1356 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1356..1362 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1362..1374 "ArgumentType" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1374..1375 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1375..1377 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1377..1385 "extends" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1385..1386 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1386..1387 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1387..1389 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1389..1392 "any" [] [], + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1392..1394 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1394..1397 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@1397..1400 "any" [] [], + }, + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1400..1402 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1402..1404 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1404..1406 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1406..1414 "extends" [] [Whitespace(" ")], + extends_type: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1414..1415 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1415..1416 "a" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1416..1418 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1418..1424 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1424..1425 "A" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1425..1427 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1427..1430 "=>" [] [Whitespace(" ")], + return_type: TsAnyType { + any_token: ANY_KW@1430..1434 "any" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1434..1436 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1436..1438 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1438..1440 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@1440..1443 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@1443..1444 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1444..1450 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1450..1452 "X3" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1452..1453 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1453..1454 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1454..1456 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1456..1458 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1458..1460 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1460..1468 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@1468..1470 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1470..1471 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1471..1473 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1473..1474 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1474..1475 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1475..1477 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1477..1483 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1483..1484 "U" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1484..1486 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1486..1489 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@1489..1493 "void" [] [], + }, + }, + }, + separator_token: COMMA@1493..1495 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1495..1496 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1496..1498 ":" [] [Whitespace(" ")], + ty: TsFunctionType { + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1498..1499 "(" [] [], + items: JsParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@1499..1500 "x" [] [], + }, + question_mark_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1500..1502 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1502..1508 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1508..1509 "U" [] [], + }, + constraint: missing (optional), + }, + }, + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@1509..1511 ")" [] [Whitespace(" ")], + }, + fat_arrow_token: FAT_ARROW@1511..1514 "=>" [] [Whitespace(" ")], + return_type: TsVoidType { + void_token: VOID_KW@1514..1519 "void" [] [Whitespace(" ")], + }, + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1519..1521 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1521..1523 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1523..1525 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1525..1527 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1527..1532 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1532..1533 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1533..1539 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1539..1541 "X1" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1541..1542 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1542..1544 "T" [] [Whitespace(" ")], + }, + constraint: TsTypeConstraintClause { + extends_token: EXTENDS_KW@1544..1552 "extends" [] [Whitespace(" ")], + ty: TsObjectType { + l_curly_token: L_CURLY@1552..1554 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1554..1555 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1555..1557 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1557..1560 "any" [] [], + }, + }, + separator_token: COMMA@1560..1562 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1562..1563 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1563..1565 ":" [] [Whitespace(" ")], + ty: TsAnyType { + any_token: ANY_KW@1565..1569 "any" [] [Whitespace(" ")], + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1569..1570 "}" [] [], + }, + }, + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1570..1572 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1572..1574 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1574..1576 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1576..1584 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@1584..1586 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1586..1587 "x" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1587..1589 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1589..1595 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1595..1596 "X" [] [], + }, + constraint: missing (optional), + }, + }, + separator_token: COMMA@1596..1598 "," [] [Whitespace(" ")], + }, + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@1598..1599 "y" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@1599..1601 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1601..1607 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1607..1609 "Y" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1609..1611 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1611..1613 "?" [] [Whitespace(" ")], + true_type: TsTupleType { + l_brack_token: L_BRACK@1613..1614 "[" [] [], + elements: TsTupleTypeElementList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1614..1615 "X" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1615..1617 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1617..1618 "Y" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_brack_token: R_BRACK@1618..1620 "]" [] [Whitespace(" ")], + }, + colon_token: COLON@1620..1622 ":" [] [Whitespace(" ")], + false_type: TsAnyType { + any_token: ANY_KW@1622..1625 "any" [] [], + }, + }, + semicolon_token: SEMICOLON@1625..1626 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1626..1632 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1632..1635 "T62" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1635..1636 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1636..1637 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1637..1639 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1639..1641 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1641..1643 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1643..1651 "extends" [] [Whitespace(" ")], + extends_type: TsArrayType { + element_type: TsParenthesizedType { + l_paren_token: L_PAREN@1651..1652 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1652..1658 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1658..1659 "U" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1659..1660 ")" [] [], + }, + l_brack_token: L_BRACK@1660..1661 "[" [] [], + r_brack_token: R_BRACK@1661..1663 "]" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1663..1665 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1665..1667 "U" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1667..1669 ":" [] [Whitespace(" ")], + false_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1669..1670 "U" [] [], + }, + type_arguments: missing (optional), + }, + }, + semicolon_token: SEMICOLON@1670..1671 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1671..1677 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1677..1680 "T63" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1680..1681 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1681..1682 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1682..1684 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1684..1686 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1686..1688 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1688..1696 "extends" [] [Whitespace(" ")], + extends_type: TsParenthesizedType { + l_paren_token: L_PAREN@1696..1697 "(" [] [], + ty: TsConditionalType { + check_type: TsParenthesizedType { + l_paren_token: L_PAREN@1697..1698 "(" [] [], + ty: TsInferType { + infer_token: INFER_KW@1698..1704 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1704..1705 "A" [] [], + }, + constraint: missing (optional), + }, + r_paren_token: R_PAREN@1705..1707 ")" [] [Whitespace(" ")], + }, + extends_token: EXTENDS_KW@1707..1715 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@1715..1721 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1721..1723 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@1723..1725 "?" [] [Whitespace(" ")], + true_type: TsInferType { + infer_token: INFER_KW@1725..1731 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1731..1733 "C" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + colon_token: COLON@1733..1735 ":" [] [Whitespace(" ")], + false_type: TsInferType { + infer_token: INFER_KW@1735..1741 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1741..1742 "D" [] [], + }, + constraint: missing (optional), + }, + }, + r_paren_token: R_PAREN@1742..1744 ")" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1744..1746 "?" [] [Whitespace(" ")], + true_type: TsStringType { + string_token: STRING_KW@1746..1753 "string" [] [Whitespace(" ")], + }, + colon_token: COLON@1753..1755 ":" [] [Whitespace(" ")], + false_type: TsNumberType { + number_token: NUMBER_KW@1755..1761 "number" [] [], + }, + }, + semicolon_token: SEMICOLON@1761..1762 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1762..1768 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1768..1771 "T75" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1771..1772 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1772..1773 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1773..1775 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1775..1777 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1777..1779 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1779..1787 "extends" [] [Whitespace(" ")], + extends_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1787..1790 "T74" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1790..1791 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsInferType { + infer_token: INFER_KW@1791..1797 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1797..1798 "U" [] [], + }, + constraint: missing (optional), + }, + COMMA@1798..1800 "," [] [Whitespace(" ")], + TsInferType { + infer_token: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1806..1807 "U" [] [], + }, + constraint: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1807..1809 ">" [] [Whitespace(" ")], + }, + }, + question_mark_token: QUESTION@1809..1811 "?" [] [Whitespace(" ")], + true_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1811..1814 "T70" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1814..1815 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1815..1816 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1816..1818 ">" [] [Whitespace(" ")], + }, + }, + PIPE@1818..1820 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1820..1823 "T72" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1823..1824 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1824..1825 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1825..1827 ">" [] [Whitespace(" ")], + }, + }, + PIPE@1827..1829 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1829..1832 "T74" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@1832..1833 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1833..1834 "U" [] [], + }, + type_arguments: missing (optional), + }, + COMMA@1834..1836 "," [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1836..1837 "U" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1837..1839 ">" [] [Whitespace(" ")], + }, + }, + ], + }, + colon_token: COLON@1839..1841 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@1841..1846 "never" [] [], + }, + }, + semicolon_token: SEMICOLON@1846..1847 ";" [] [], + }, + TsTypeAliasDeclaration { + type_token: TYPE_KW@1847..1853 "type" [Newline("\n")] [Whitespace(" ")], + binding_identifier: TsIdentifierBinding { + name_token: IDENT@1853..1862 "Jsonified" [] [], + }, + type_parameters: TsTypeParameters { + l_angle_token: L_ANGLE@1862..1863 "<" [] [], + items: TsTypeParameterList [ + TsTypeParameter { + modifiers: TsTypeParameterModifierList [], + name: TsTypeParameterName { + ident_token: IDENT@1863..1864 "T" [] [], + }, + constraint: missing (optional), + default: missing (optional), + }, + ], + r_angle_token: R_ANGLE@1864..1866 ">" [] [Whitespace(" ")], + }, + eq_token: EQ@1866..1868 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1868..1870 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1870..1878 "extends" [] [Whitespace(" ")], + extends_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsStringType { + string_token: STRING_KW@1878..1885 "string" [] [Whitespace(" ")], + }, + PIPE@1885..1887 "|" [] [Whitespace(" ")], + TsNumberType { + number_token: NUMBER_KW@1887..1894 "number" [] [Whitespace(" ")], + }, + PIPE@1894..1896 "|" [] [Whitespace(" ")], + TsBooleanType { + boolean_token: BOOLEAN_KW@1896..1904 "boolean" [] [Whitespace(" ")], + }, + PIPE@1904..1906 "|" [] [Whitespace(" ")], + TsNullLiteralType { + literal_token: NULL_KW@1906..1911 "null" [] [Whitespace(" ")], + }, + ], + }, + question_mark_token: QUESTION@1911..1913 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1913..1914 "T" [] [], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@1914..1921 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1921..1923 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1923..1931 "extends" [] [Whitespace(" ")], + extends_type: TsUnionType { + leading_separator_token: missing (optional), + types: TsUnionTypeVariantList [ + TsUndefinedType { + undefined_token: UNDEFINED_KW@1931..1941 "undefined" [] [Whitespace(" ")], + }, + PIPE@1941..1943 "|" [] [Whitespace(" ")], + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1943..1952 "Function" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + ], + }, + question_mark_token: QUESTION@1952..1954 "?" [] [Whitespace(" ")], + true_type: TsNeverType { + never_token: NEVER_KW@1954..1959 "never" [] [], + }, + colon_token: COLON@1959..1966 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@1966..1968 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@1968..1976 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@1976..1978 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsMethodSignatureTypeMember { + name: JsLiteralMemberName { + value: IDENT@1978..1984 "toJSON" [] [], + }, + optional_token: missing (optional), + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@1984..1985 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@1985..1986 ")" [] [], + }, + return_type_annotation: TsReturnTypeAnnotation { + colon_token: COLON@1986..1988 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@1988..1994 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@1994..1996 "R" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + }, + separator_token: missing (optional), + }, + ], + r_curly_token: R_CURLY@1996..1998 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@1998..2000 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2000..2001 "R" [] [], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@2001..2008 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + false_type: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2008..2010 "T" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@2010..2018 "extends" [] [Whitespace(" ")], + extends_type: TsNonPrimitiveType { + object_token: OBJECT_KW@2018..2025 "object" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@2025..2027 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2027..2042 "JsonifiedObject" [] [], + }, + type_arguments: TsTypeArguments { + l_angle_token: L_ANGLE@2042..2043 "<" [] [], + ts_type_argument_list: TsTypeArgumentList [ + TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@2043..2044 "T" [] [], + }, + type_arguments: missing (optional), + }, + ], + r_angle_token: R_ANGLE@2044..2045 ">" [] [], + }, + }, + colon_token: COLON@2045..2048 ":" [Newline("\n")] [Whitespace(" ")], + false_type: TsStringLiteralType { + literal_token: JS_STRING_LITERAL@2048..2062 "\"what is this\"" [] [], + }, + }, + }, + }, + }, + semicolon_token: SEMICOLON@2062..2063 ";" [] [], + }, + ], + eof_token: EOF@2063..2064 "" [Newline("\n")] [], +} + +0: JS_MODULE@0..2064 + 0: (empty) + 1: JS_DIRECTIVE_LIST@0..0 + 2: JS_MODULE_ITEM_LIST@0..2063 + 0: TS_TYPE_ALIAS_DECLARATION@0..56 + 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@5..7 + 0: IDENT@5..7 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@7..9 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@9..56 + 0: TS_REFERENCE_TYPE@9..11 + 0: JS_REFERENCE_IDENTIFIER@9..11 + 0: IDENT@9..11 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] + 2: TS_IMPORT_TYPE@19..45 + 0: (empty) + 1: IMPORT_KW@19..25 "import" [] [] + 2: L_PAREN@25..26 "(" [] [] + 3: JS_STRING_LITERAL@26..32 "\"test\"" [] [] + 4: R_PAREN@32..33 ")" [] [] + 5: TS_IMPORT_TYPE_QUALIFIER@33..35 + 0: DOT@33..34 "." [] [] + 1: JS_REFERENCE_IDENTIFIER@34..35 + 0: IDENT@34..35 "C" [] [] + 6: TS_TYPE_ARGUMENTS@35..45 + 0: L_ANGLE@35..36 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@36..43 + 0: TS_INFER_TYPE@36..43 + 0: INFER_KW@36..42 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@42..43 + 0: IDENT@42..43 "P" [] [] + 2: (empty) + 2: R_ANGLE@43..45 ">" [] [Whitespace(" ")] + 3: QUESTION@45..47 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@47..49 + 0: JS_REFERENCE_IDENTIFIER@47..49 + 0: IDENT@47..49 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@49..51 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@51..56 + 0: NEVER_KW@51..56 "never" [] [] + 5: (empty) + 1: TS_TYPE_ALIAS_DECLARATION@56..109 + 0: TYPE_KW@56..62 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@62..64 + 0: IDENT@62..64 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@64..66 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@66..109 + 0: TS_REFERENCE_TYPE@66..68 + 0: JS_REFERENCE_IDENTIFIER@66..68 + 0: IDENT@66..68 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@68..76 "extends" [] [Whitespace(" ")] + 2: TS_TYPEOF_TYPE@76..98 + 0: TYPEOF_KW@76..83 "typeof" [] [Whitespace(" ")] + 1: JS_REFERENCE_IDENTIFIER@83..88 + 0: IDENT@83..88 "Array" [] [] + 2: TS_TYPE_ARGUMENTS@88..98 + 0: L_ANGLE@88..89 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@89..96 + 0: TS_INFER_TYPE@89..96 + 0: INFER_KW@89..95 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@95..96 + 0: IDENT@95..96 "P" [] [] + 2: (empty) + 2: R_ANGLE@96..98 ">" [] [Whitespace(" ")] + 3: QUESTION@98..100 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@100..102 + 0: JS_REFERENCE_IDENTIFIER@100..102 + 0: IDENT@100..102 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@102..104 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@104..109 + 0: NEVER_KW@104..109 "never" [] [] + 5: (empty) + 2: TS_TYPE_ALIAS_DECLARATION@109..168 + 0: TYPE_KW@109..115 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@115..117 + 0: IDENT@115..117 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@117..119 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@119..168 + 0: TS_REFERENCE_TYPE@119..121 + 0: JS_REFERENCE_IDENTIFIER@119..121 + 0: IDENT@119..121 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@121..129 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@129..157 + 0: L_CURLY@129..131 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@131..155 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@131..155 + 0: JS_LITERAL_MEMBER_NAME@131..134 + 0: IDENT@131..134 "set" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@134..146 + 0: L_PAREN@134..135 "(" [] [] + 1: JS_PARAMETER_LIST@135..145 + 0: JS_FORMAL_PARAMETER@135..145 + 0: JS_DECORATOR_LIST@135..135 + 1: JS_IDENTIFIER_BINDING@135..136 + 0: IDENT@135..136 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@136..145 + 0: COLON@136..138 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@138..145 + 0: INFER_KW@138..144 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@144..145 + 0: IDENT@144..145 "P" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@145..146 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@146..155 + 0: COLON@146..148 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@148..155 + 0: NUMBER_KW@148..155 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@155..157 "}" [] [Whitespace(" ")] + 3: QUESTION@157..159 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@159..161 + 0: JS_REFERENCE_IDENTIFIER@159..161 + 0: IDENT@159..161 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@161..163 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@163..168 + 0: NEVER_KW@163..168 "never" [] [] + 5: (empty) + 3: TS_TYPE_ALIAS_DECLARATION@168..218 + 0: TYPE_KW@168..174 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@174..176 + 0: IDENT@174..176 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@176..178 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@178..218 + 0: TS_REFERENCE_TYPE@178..180 + 0: JS_REFERENCE_IDENTIFIER@178..180 + 0: IDENT@178..180 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@180..188 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@188..207 + 0: L_CURLY@188..190 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@190..205 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@190..205 + 0: JS_LITERAL_MEMBER_NAME@190..193 + 0: IDENT@190..193 "get" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@193..195 + 0: L_PAREN@193..194 "(" [] [] + 1: JS_PARAMETER_LIST@194..194 + 2: R_PAREN@194..195 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@195..205 + 0: COLON@195..197 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@197..205 + 0: INFER_KW@197..203 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@203..205 + 0: IDENT@203..205 "P" [] [Whitespace(" ")] + 2: (empty) + 5: (empty) + 2: R_CURLY@205..207 "}" [] [Whitespace(" ")] + 3: QUESTION@207..209 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@209..211 + 0: JS_REFERENCE_IDENTIFIER@209..211 + 0: IDENT@209..211 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@211..213 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@213..218 + 0: NEVER_KW@213..218 "never" [] [] + 5: (empty) + 4: TS_TYPE_ALIAS_DECLARATION@218..283 + 0: TYPE_KW@218..224 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@224..226 + 0: IDENT@224..226 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@226..228 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@228..283 + 0: TS_REFERENCE_TYPE@228..230 + 0: JS_REFERENCE_IDENTIFIER@228..230 + 0: IDENT@228..230 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@230..238 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@238..272 + 0: L_CURLY@238..240 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@240..270 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@240..270 + 0: JS_LITERAL_MEMBER_NAME@240..246 + 0: IDENT@240..246 "method" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@246..261 + 0: L_PAREN@246..247 "(" [] [] + 1: JS_PARAMETER_LIST@247..260 + 0: TS_THIS_PARAMETER@247..260 + 0: THIS_KW@247..251 "this" [] [] + 1: TS_TYPE_ANNOTATION@251..260 + 0: COLON@251..253 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@253..260 + 0: INFER_KW@253..259 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@259..260 + 0: IDENT@259..260 "P" [] [] + 2: (empty) + 2: R_PAREN@260..261 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@261..270 + 0: COLON@261..263 ":" [] [Whitespace(" ")] + 1: TS_NUMBER_TYPE@263..270 + 0: NUMBER_KW@263..270 "number" [] [Whitespace(" ")] + 5: (empty) + 2: R_CURLY@270..272 "}" [] [Whitespace(" ")] + 3: QUESTION@272..274 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@274..276 + 0: JS_REFERENCE_IDENTIFIER@274..276 + 0: IDENT@274..276 "P" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@276..278 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@278..283 + 0: NEVER_KW@278..283 "never" [] [] + 5: (empty) + 5: TS_TYPE_ALIAS_DECLARATION@283..336 + 0: TYPE_KW@283..289 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@289..295 + 0: IDENT@289..295 "valid9" [] [] + 2: TS_TYPE_PARAMETERS@295..299 + 0: L_ANGLE@295..296 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@296..297 + 0: TS_TYPE_PARAMETER@296..297 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@296..296 + 1: TS_TYPE_PARAMETER_NAME@296..297 + 0: IDENT@296..297 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@297..299 ">" [] [Whitespace(" ")] + 3: EQ@299..301 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@301..335 + 0: TS_REFERENCE_TYPE@301..303 + 0: JS_REFERENCE_IDENTIFIER@301..303 + 0: IDENT@301..303 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@303..311 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@311..326 + 0: JS_REFERENCE_IDENTIFIER@311..316 + 0: IDENT@311..316 "Array" [] [] + 1: TS_TYPE_ARGUMENTS@316..326 + 0: L_ANGLE@316..317 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@317..324 + 0: TS_INFER_TYPE@317..324 + 0: INFER_KW@317..323 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@323..324 + 0: IDENT@323..324 "R" [] [] + 2: (empty) + 2: R_ANGLE@324..326 ">" [] [Whitespace(" ")] + 3: QUESTION@326..328 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@328..330 + 0: JS_REFERENCE_IDENTIFIER@328..330 + 0: IDENT@328..330 "R" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@330..332 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@332..335 + 0: ANY_KW@332..335 "any" [] [] + 5: SEMICOLON@335..336 ";" [] [] + 6: TS_TYPE_ALIAS_DECLARATION@336..407 + 0: TYPE_KW@336..342 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@342..364 + 0: IDENT@342..364 "ContentBetweenBrackets" [] [] + 2: TS_TYPE_PARAMETERS@364..368 + 0: L_ANGLE@364..365 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@365..366 + 0: TS_TYPE_PARAMETER@365..366 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@365..365 + 1: TS_TYPE_PARAMETER_NAME@365..366 + 0: IDENT@365..366 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@366..368 ">" [] [Whitespace(" ")] + 3: EQ@368..370 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@370..406 + 0: TS_REFERENCE_TYPE@370..372 + 0: JS_REFERENCE_IDENTIFIER@370..372 + 0: IDENT@370..372 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@372..380 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@380..395 + 0: BACKTICK@380..381 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@381..393 + 0: TS_TEMPLATE_CHUNK_ELEMENT@381..382 + 0: TEMPLATE_CHUNK@381..382 "[" [] [] + 1: TS_TEMPLATE_ELEMENT@382..392 + 0: DOLLAR_CURLY@382..384 "${" [] [] + 1: TS_INFER_TYPE@384..391 + 0: INFER_KW@384..390 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@390..391 + 0: IDENT@390..391 "T" [] [] + 2: (empty) + 2: R_CURLY@391..392 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@392..393 + 0: TEMPLATE_CHUNK@392..393 "]" [] [] + 2: BACKTICK@393..395 "`" [] [Whitespace(" ")] + 3: QUESTION@395..397 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@397..399 + 0: JS_REFERENCE_IDENTIFIER@397..399 + 0: IDENT@397..399 "T" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@399..401 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@401..406 + 0: NEVER_KW@401..406 "never" [] [] + 5: SEMICOLON@406..407 ";" [] [] + 7: TS_TYPE_ALIAS_DECLARATION@407..532 + 0: TYPE_KW@407..413 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@413..426 + 0: IDENT@413..426 "WithSelectors" [] [] + 2: TS_TYPE_PARAMETERS@426..430 + 0: L_ANGLE@426..427 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@427..428 + 0: TS_TYPE_PARAMETER@427..428 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@427..427 + 1: TS_TYPE_PARAMETER_NAME@427..428 + 0: IDENT@427..428 "S" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@428..430 ">" [] [Whitespace(" ")] + 3: EQ@430..432 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@432..531 + 0: TS_REFERENCE_TYPE@432..434 + 0: JS_REFERENCE_IDENTIFIER@432..434 + 0: IDENT@432..434 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@434..442 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@442..469 + 0: L_CURLY@442..444 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@444..468 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@444..468 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@444..452 + 0: IDENT@444..452 "getState" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@452..468 + 0: COLON@452..454 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@454..468 + 0: (empty) + 1: JS_PARAMETERS@454..457 + 0: L_PAREN@454..455 "(" [] [] + 1: JS_PARAMETER_LIST@455..455 + 2: R_PAREN@455..457 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@457..460 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@460..468 + 0: INFER_KW@460..466 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@466..468 + 0: IDENT@466..468 "T" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@468..469 "}" [] [] + 3: QUESTION@469..476 "?" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 4: TS_INTERSECTION_TYPE@476..519 + 0: (empty) + 1: TS_INTERSECTION_TYPE_ELEMENT_LIST@476..519 + 0: TS_REFERENCE_TYPE@476..478 + 0: JS_REFERENCE_IDENTIFIER@476..478 + 0: IDENT@476..478 "S" [] [Whitespace(" ")] + 1: (empty) + 1: AMP@478..480 "&" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@480..519 + 0: L_CURLY@480..482 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@482..518 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@482..518 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@482..485 + 0: IDENT@482..485 "use" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@485..518 + 0: COLON@485..487 ":" [] [Whitespace(" ")] + 1: TS_MAPPED_TYPE@487..518 + 0: L_CURLY@487..489 "{" [] [Whitespace(" ")] + 1: (empty) + 2: L_BRACK@489..490 "[" [] [] + 3: TS_TYPE_PARAMETER_NAME@490..492 + 0: IDENT@490..492 "K" [] [Whitespace(" ")] + 4: IN_KW@492..495 "in" [] [Whitespace(" ")] + 5: TS_TYPE_OPERATOR_TYPE@495..502 + 0: KEYOF_KW@495..501 "keyof" [] [Whitespace(" ")] + 1: TS_REFERENCE_TYPE@501..502 + 0: JS_REFERENCE_IDENTIFIER@501..502 + 0: IDENT@501..502 "T" [] [] + 1: (empty) + 6: (empty) + 7: R_BRACK@502..503 "]" [] [] + 8: (empty) + 9: TS_TYPE_ANNOTATION@503..516 + 0: COLON@503..505 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@505..516 + 0: (empty) + 1: JS_PARAMETERS@505..508 + 0: L_PAREN@505..506 "(" [] [] + 1: JS_PARAMETER_LIST@506..506 + 2: R_PAREN@506..508 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@508..511 "=>" [] [Whitespace(" ")] + 3: TS_INDEXED_ACCESS_TYPE@511..516 + 0: TS_REFERENCE_TYPE@511..512 + 0: JS_REFERENCE_IDENTIFIER@511..512 + 0: IDENT@511..512 "T" [] [] + 1: (empty) + 1: L_BRACK@512..513 "[" [] [] + 2: TS_REFERENCE_TYPE@513..514 + 0: JS_REFERENCE_IDENTIFIER@513..514 + 0: IDENT@513..514 "K" [] [] + 1: (empty) + 3: R_BRACK@514..516 "]" [] [Whitespace(" ")] + 10: (empty) + 11: R_CURLY@516..518 "}" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@518..519 "}" [] [] + 5: COLON@519..526 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_NEVER_TYPE@526..531 + 0: NEVER_KW@526..531 "never" [] [] + 5: SEMICOLON@531..532 ";" [] [] + 8: TS_TYPE_ALIAS_DECLARATION@532..632 + 0: TYPE_KW@532..538 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@538..540 + 0: IDENT@538..540 "A" [] [Whitespace(" ")] + 2: (empty) + 3: EQ@540..542 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@542..632 + 0: TS_REFERENCE_TYPE@542..549 + 0: JS_REFERENCE_IDENTIFIER@542..549 + 0: IDENT@542..549 "MyType" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@549..557 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@557..608 + 0: L_PAREN@557..558 "(" [] [] + 1: TS_CONDITIONAL_TYPE@558..606 + 0: TS_REFERENCE_TYPE@558..568 + 0: JS_REFERENCE_IDENTIFIER@558..568 + 0: IDENT@558..568 "OtherType" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@568..576 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@576..584 + 0: INFER_KW@576..582 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@582..584 + 0: IDENT@582..584 "T" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@584..586 "?" [] [Whitespace(" ")] + 4: TS_INFER_TYPE@586..594 + 0: INFER_KW@586..592 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@592..594 + 0: IDENT@592..594 "U" [] [Whitespace(" ")] + 2: (empty) + 5: COLON@594..596 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@596..606 + 0: JS_REFERENCE_IDENTIFIER@596..606 + 0: IDENT@596..606 "InnerFalse" [] [] + 1: (empty) + 2: R_PAREN@606..608 ")" [] [Whitespace(" ")] + 3: QUESTION@608..610 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@610..620 + 0: JS_REFERENCE_IDENTIFIER@610..620 + 0: IDENT@610..620 "OuterTrue" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@620..622 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@622..632 + 0: JS_REFERENCE_IDENTIFIER@622..632 + 0: IDENT@622..632 "OuterFalse" [] [] + 1: (empty) + 5: (empty) + 9: TS_TYPE_ALIAS_DECLARATION@632..882 + 0: TYPE_KW@632..638 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@638..642 + 0: IDENT@638..642 "Join" [] [] + 2: TS_TYPE_PARAMETERS@642..682 + 0: L_ANGLE@642..643 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@643..680 + 0: TS_TYPE_PARAMETER@643..662 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@643..643 + 1: TS_TYPE_PARAMETER_NAME@643..645 + 0: IDENT@643..645 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@645..662 + 0: EXTENDS_KW@645..653 "extends" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@653..662 + 0: TS_UNKNOWN_TYPE@653..660 + 0: UNKNOWN_KW@653..660 "unknown" [] [] + 1: L_BRACK@660..661 "[" [] [] + 2: R_BRACK@661..662 "]" [] [] + 3: (empty) + 1: COMMA@662..664 "," [] [Whitespace(" ")] + 2: TS_TYPE_PARAMETER@664..680 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@664..664 + 1: TS_TYPE_PARAMETER_NAME@664..666 + 0: IDENT@664..666 "D" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@666..680 + 0: EXTENDS_KW@666..674 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@674..680 + 0: STRING_KW@674..680 "string" [] [] + 3: (empty) + 2: R_ANGLE@680..682 ">" [] [Whitespace(" ")] + 3: EQ@682..683 "=" [] [] + 4: TS_CONDITIONAL_TYPE@683..881 + 0: TS_REFERENCE_TYPE@683..691 + 0: JS_REFERENCE_IDENTIFIER@683..691 + 0: IDENT@683..691 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@691..699 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@699..702 + 0: L_BRACK@699..700 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@700..700 + 2: R_BRACK@700..702 "]" [] [Whitespace(" ")] + 3: QUESTION@702..704 "?" [] [Whitespace(" ")] + 4: TS_STRING_LITERAL_TYPE@704..707 + 0: JS_STRING_LITERAL@704..707 "''" [] [Whitespace(" ")] + 5: COLON@707..708 ":" [] [] + 6: TS_CONDITIONAL_TYPE@708..881 + 0: TS_REFERENCE_TYPE@708..716 + 0: JS_REFERENCE_IDENTIFIER@708..716 + 0: IDENT@708..716 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@716..724 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@724..761 + 0: L_BRACK@724..725 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@725..759 + 0: TS_UNION_TYPE@725..759 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@725..759 + 0: TS_STRING_TYPE@725..732 + 0: STRING_KW@725..732 "string" [] [Whitespace(" ")] + 1: PIPE@732..734 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@734..741 + 0: NUMBER_KW@734..741 "number" [] [Whitespace(" ")] + 3: PIPE@741..743 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@743..751 + 0: BOOLEAN_KW@743..751 "boolean" [] [Whitespace(" ")] + 5: PIPE@751..753 "|" [] [Whitespace(" ")] + 6: TS_BIGINT_TYPE@753..759 + 0: BIGINT_KW@753..759 "bigint" [] [] + 2: R_BRACK@759..761 "]" [] [Whitespace(" ")] + 3: QUESTION@761..763 "?" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@763..773 + 0: BACKTICK@763..764 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@764..771 + 0: TS_TEMPLATE_ELEMENT@764..771 + 0: DOLLAR_CURLY@764..766 "${" [] [] + 1: TS_INDEXED_ACCESS_TYPE@766..770 + 0: TS_REFERENCE_TYPE@766..767 + 0: JS_REFERENCE_IDENTIFIER@766..767 + 0: IDENT@766..767 "T" [] [] + 1: (empty) + 1: L_BRACK@767..768 "[" [] [] + 2: TS_NUMBER_LITERAL_TYPE@768..769 + 0: (empty) + 1: JS_NUMBER_LITERAL@768..769 "0" [] [] + 3: R_BRACK@769..770 "]" [] [] + 2: R_CURLY@770..771 "}" [] [] + 2: BACKTICK@771..773 "`" [] [Whitespace(" ")] + 5: COLON@773..774 ":" [] [] + 6: TS_CONDITIONAL_TYPE@774..881 + 0: TS_REFERENCE_TYPE@774..782 + 0: JS_REFERENCE_IDENTIFIER@774..782 + 0: IDENT@774..782 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@782..790 "extends" [] [Whitespace(" ")] + 2: TS_TUPLE_TYPE@790..839 + 0: L_BRACK@790..791 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@791..837 + 0: TS_UNION_TYPE@791..825 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@791..825 + 0: TS_STRING_TYPE@791..798 + 0: STRING_KW@791..798 "string" [] [Whitespace(" ")] + 1: PIPE@798..800 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@800..807 + 0: NUMBER_KW@800..807 "number" [] [Whitespace(" ")] + 3: PIPE@807..809 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@809..817 + 0: BOOLEAN_KW@809..817 "boolean" [] [Whitespace(" ")] + 5: PIPE@817..819 "|" [] [Whitespace(" ")] + 6: TS_BIGINT_TYPE@819..825 + 0: BIGINT_KW@819..825 "bigint" [] [] + 1: COMMA@825..827 "," [] [Whitespace(" ")] + 2: TS_REST_TUPLE_TYPE_ELEMENT@827..837 + 0: DOT3@827..830 "..." [] [] + 1: TS_INFER_TYPE@830..837 + 0: INFER_KW@830..836 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@836..837 + 0: IDENT@836..837 "U" [] [] + 2: (empty) + 2: R_BRACK@837..839 "]" [] [Whitespace(" ")] + 3: QUESTION@839..841 "?" [] [Whitespace(" ")] + 4: TS_TEMPLATE_LITERAL_TYPE@841..868 + 0: BACKTICK@841..842 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@842..866 + 0: TS_TEMPLATE_ELEMENT@842..849 + 0: DOLLAR_CURLY@842..844 "${" [] [] + 1: TS_INDEXED_ACCESS_TYPE@844..848 + 0: TS_REFERENCE_TYPE@844..845 + 0: JS_REFERENCE_IDENTIFIER@844..845 + 0: IDENT@844..845 "T" [] [] + 1: (empty) + 1: L_BRACK@845..846 "[" [] [] + 2: TS_NUMBER_LITERAL_TYPE@846..847 + 0: (empty) + 1: JS_NUMBER_LITERAL@846..847 "0" [] [] + 3: R_BRACK@847..848 "]" [] [] + 2: R_CURLY@848..849 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@849..853 + 0: DOLLAR_CURLY@849..851 "${" [] [] + 1: TS_REFERENCE_TYPE@851..852 + 0: JS_REFERENCE_IDENTIFIER@851..852 + 0: IDENT@851..852 "D" [] [] + 1: (empty) + 2: R_CURLY@852..853 "}" [] [] + 2: TS_TEMPLATE_ELEMENT@853..866 + 0: DOLLAR_CURLY@853..855 "${" [] [] + 1: TS_REFERENCE_TYPE@855..865 + 0: JS_REFERENCE_IDENTIFIER@855..859 + 0: IDENT@855..859 "Join" [] [] + 1: TS_TYPE_ARGUMENTS@859..865 + 0: L_ANGLE@859..860 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@860..864 + 0: TS_REFERENCE_TYPE@860..861 + 0: JS_REFERENCE_IDENTIFIER@860..861 + 0: IDENT@860..861 "U" [] [] + 1: (empty) + 1: COMMA@861..863 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@863..864 + 0: JS_REFERENCE_IDENTIFIER@863..864 + 0: IDENT@863..864 "D" [] [] + 1: (empty) + 2: R_ANGLE@864..865 ">" [] [] + 2: R_CURLY@865..866 "}" [] [] + 2: BACKTICK@866..868 "`" [] [Whitespace(" ")] + 5: COLON@868..869 ":" [] [] + 6: TS_STRING_TYPE@869..881 + 0: STRING_KW@869..881 "string" [Newline("\n"), Whitespace(" ")] [] + 5: SEMICOLON@881..882 ";" [] [] + 10: TS_TYPE_ALIAS_DECLARATION@882..973 + 0: TYPE_KW@882..888 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@888..897 + 0: IDENT@888..897 "MatchPair" [] [] + 2: TS_TYPE_PARAMETERS@897..916 + 0: L_ANGLE@897..898 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@898..914 + 0: TS_TYPE_PARAMETER@898..914 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@898..898 + 1: TS_TYPE_PARAMETER_NAME@898..900 + 0: IDENT@898..900 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@900..914 + 0: EXTENDS_KW@900..908 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@908..914 + 0: STRING_KW@908..914 "string" [] [] + 3: (empty) + 2: R_ANGLE@914..916 ">" [] [Whitespace(" ")] + 3: EQ@916..918 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@918..972 + 0: TS_REFERENCE_TYPE@918..920 + 0: JS_REFERENCE_IDENTIFIER@918..920 + 0: IDENT@918..920 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@920..928 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@928..954 + 0: BACKTICK@928..929 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@929..952 + 0: TS_TEMPLATE_CHUNK_ELEMENT@929..930 + 0: TEMPLATE_CHUNK@929..930 "[" [] [] + 1: TS_TEMPLATE_ELEMENT@930..940 + 0: DOLLAR_CURLY@930..932 "${" [] [] + 1: TS_INFER_TYPE@932..939 + 0: INFER_KW@932..938 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@938..939 + 0: IDENT@938..939 "A" [] [] + 2: (empty) + 2: R_CURLY@939..940 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@940..941 + 0: TEMPLATE_CHUNK@940..941 "," [] [] + 3: TS_TEMPLATE_ELEMENT@941..951 + 0: DOLLAR_CURLY@941..943 "${" [] [] + 1: TS_INFER_TYPE@943..950 + 0: INFER_KW@943..949 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@949..950 + 0: IDENT@949..950 "B" [] [] + 2: (empty) + 2: R_CURLY@950..951 "}" [] [] + 4: TS_TEMPLATE_CHUNK_ELEMENT@951..952 + 0: TEMPLATE_CHUNK@951..952 "]" [] [] + 2: BACKTICK@952..954 "`" [] [Whitespace(" ")] + 3: QUESTION@954..956 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@956..963 + 0: L_BRACK@956..957 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@957..961 + 0: TS_REFERENCE_TYPE@957..958 + 0: JS_REFERENCE_IDENTIFIER@957..958 + 0: IDENT@957..958 "A" [] [] + 1: (empty) + 1: COMMA@958..960 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@960..961 + 0: JS_REFERENCE_IDENTIFIER@960..961 + 0: IDENT@960..961 "B" [] [] + 1: (empty) + 2: R_BRACK@961..963 "]" [] [Whitespace(" ")] + 5: COLON@963..965 ":" [] [Whitespace(" ")] + 6: TS_UNKNOWN_TYPE@965..972 + 0: UNKNOWN_KW@965..972 "unknown" [] [] + 5: SEMICOLON@972..973 ";" [] [] + 11: TS_TYPE_ALIAS_DECLARATION@973..1086 + 0: TYPE_KW@973..979 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@979..994 + 0: IDENT@979..994 "FirstTwoAndRest" [] [] + 2: TS_TYPE_PARAMETERS@994..1013 + 0: L_ANGLE@994..995 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@995..1011 + 0: TS_TYPE_PARAMETER@995..1011 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@995..995 + 1: TS_TYPE_PARAMETER_NAME@995..997 + 0: IDENT@995..997 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@997..1011 + 0: EXTENDS_KW@997..1005 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@1005..1011 + 0: STRING_KW@1005..1011 "string" [] [] + 3: (empty) + 2: R_ANGLE@1011..1013 ">" [] [Whitespace(" ")] + 3: EQ@1013..1015 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1015..1085 + 0: TS_REFERENCE_TYPE@1015..1017 + 0: JS_REFERENCE_IDENTIFIER@1015..1017 + 0: IDENT@1015..1017 "S" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1017..1025 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1025..1058 + 0: BACKTICK@1025..1026 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1026..1056 + 0: TS_TEMPLATE_ELEMENT@1026..1036 + 0: DOLLAR_CURLY@1026..1028 "${" [] [] + 1: TS_INFER_TYPE@1028..1035 + 0: INFER_KW@1028..1034 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1034..1035 + 0: IDENT@1034..1035 "A" [] [] + 2: (empty) + 2: R_CURLY@1035..1036 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@1036..1046 + 0: DOLLAR_CURLY@1036..1038 "${" [] [] + 1: TS_INFER_TYPE@1038..1045 + 0: INFER_KW@1038..1044 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1044..1045 + 0: IDENT@1044..1045 "B" [] [] + 2: (empty) + 2: R_CURLY@1045..1046 "}" [] [] + 2: TS_TEMPLATE_ELEMENT@1046..1056 + 0: DOLLAR_CURLY@1046..1048 "${" [] [] + 1: TS_INFER_TYPE@1048..1055 + 0: INFER_KW@1048..1054 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1054..1055 + 0: IDENT@1054..1055 "R" [] [] + 2: (empty) + 2: R_CURLY@1055..1056 "}" [] [] + 2: BACKTICK@1056..1058 "`" [] [Whitespace(" ")] + 3: QUESTION@1058..1060 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@1060..1076 + 0: L_BRACK@1060..1061 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1061..1074 + 0: TS_TEMPLATE_LITERAL_TYPE@1061..1071 + 0: BACKTICK@1061..1062 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1062..1070 + 0: TS_TEMPLATE_ELEMENT@1062..1066 + 0: DOLLAR_CURLY@1062..1064 "${" [] [] + 1: TS_REFERENCE_TYPE@1064..1065 + 0: JS_REFERENCE_IDENTIFIER@1064..1065 + 0: IDENT@1064..1065 "A" [] [] + 1: (empty) + 2: R_CURLY@1065..1066 "}" [] [] + 1: TS_TEMPLATE_ELEMENT@1066..1070 + 0: DOLLAR_CURLY@1066..1068 "${" [] [] + 1: TS_REFERENCE_TYPE@1068..1069 + 0: JS_REFERENCE_IDENTIFIER@1068..1069 + 0: IDENT@1068..1069 "B" [] [] + 1: (empty) + 2: R_CURLY@1069..1070 "}" [] [] + 2: BACKTICK@1070..1071 "`" [] [] + 1: COMMA@1071..1073 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1073..1074 + 0: JS_REFERENCE_IDENTIFIER@1073..1074 + 0: IDENT@1073..1074 "R" [] [] + 1: (empty) + 2: R_BRACK@1074..1076 "]" [] [Whitespace(" ")] + 5: COLON@1076..1078 ":" [] [Whitespace(" ")] + 6: TS_UNKNOWN_TYPE@1078..1085 + 0: UNKNOWN_KW@1078..1085 "unknown" [] [] + 5: SEMICOLON@1085..1086 ";" [] [] + 12: TS_TYPE_ALIAS_DECLARATION@1086..1165 + 0: TYPE_KW@1086..1092 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1092..1096 + 0: IDENT@1092..1096 "Trim" [] [] + 2: TS_TYPE_PARAMETERS@1096..1115 + 0: L_ANGLE@1096..1097 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1097..1113 + 0: TS_TYPE_PARAMETER@1097..1113 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1097..1097 + 1: TS_TYPE_PARAMETER_NAME@1097..1099 + 0: IDENT@1097..1099 "S" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1099..1113 + 0: EXTENDS_KW@1099..1107 "extends" [] [Whitespace(" ")] + 1: TS_STRING_TYPE@1107..1113 + 0: STRING_KW@1107..1113 "string" [] [] + 3: (empty) + 2: R_ANGLE@1113..1115 ">" [] [Whitespace(" ")] + 3: EQ@1115..1116 "=" [] [] + 4: TS_CONDITIONAL_TYPE@1116..1164 + 0: TS_REFERENCE_TYPE@1116..1124 + 0: JS_REFERENCE_IDENTIFIER@1116..1124 + 0: IDENT@1116..1124 "S" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1124..1132 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1132..1146 + 0: BACKTICK@1132..1133 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1133..1144 + 0: TS_TEMPLATE_ELEMENT@1133..1143 + 0: DOLLAR_CURLY@1133..1135 "${" [] [] + 1: TS_INFER_TYPE@1135..1142 + 0: INFER_KW@1135..1141 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1141..1142 + 0: IDENT@1141..1142 "T" [] [] + 2: (empty) + 2: R_CURLY@1142..1143 "}" [] [] + 1: TS_TEMPLATE_CHUNK_ELEMENT@1143..1144 + 0: TEMPLATE_CHUNK@1143..1144 " " [] [] + 2: BACKTICK@1144..1146 "`" [] [Whitespace(" ")] + 3: QUESTION@1146..1148 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1148..1156 + 0: JS_REFERENCE_IDENTIFIER@1148..1152 + 0: IDENT@1148..1152 "Trim" [] [] + 1: TS_TYPE_ARGUMENTS@1152..1156 + 0: L_ANGLE@1152..1153 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1153..1154 + 0: TS_REFERENCE_TYPE@1153..1154 + 0: JS_REFERENCE_IDENTIFIER@1153..1154 + 0: IDENT@1153..1154 "T" [] [] + 1: (empty) + 2: R_ANGLE@1154..1156 ">" [] [Whitespace(" ")] + 5: COLON@1156..1157 ":" [] [] + 6: TS_REFERENCE_TYPE@1157..1164 + 0: JS_REFERENCE_IDENTIFIER@1157..1164 + 0: IDENT@1157..1164 "S" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 5: SEMICOLON@1164..1165 ";" [] [] + 13: TS_TYPE_ALIAS_DECLARATION@1165..1217 + 0: TYPE_KW@1165..1171 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1171..1174 + 0: IDENT@1171..1174 "Foo" [] [] + 2: TS_TYPE_PARAMETERS@1174..1178 + 0: L_ANGLE@1174..1175 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1175..1176 + 0: TS_TYPE_PARAMETER@1175..1176 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1175..1175 + 1: TS_TYPE_PARAMETER_NAME@1175..1176 + 0: IDENT@1175..1176 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1176..1178 ">" [] [Whitespace(" ")] + 3: EQ@1178..1180 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1180..1216 + 0: TS_REFERENCE_TYPE@1180..1182 + 0: JS_REFERENCE_IDENTIFIER@1180..1182 + 0: IDENT@1180..1182 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1182..1190 "extends" [] [Whitespace(" ")] + 2: TS_TEMPLATE_LITERAL_TYPE@1190..1205 + 0: BACKTICK@1190..1191 "`" [] [] + 1: TS_TEMPLATE_ELEMENT_LIST@1191..1203 + 0: TS_TEMPLATE_CHUNK_ELEMENT@1191..1192 + 0: TEMPLATE_CHUNK@1191..1192 "*" [] [] + 1: TS_TEMPLATE_ELEMENT@1192..1202 + 0: DOLLAR_CURLY@1192..1194 "${" [] [] + 1: TS_INFER_TYPE@1194..1201 + 0: INFER_KW@1194..1200 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1200..1201 + 0: IDENT@1200..1201 "S" [] [] + 2: (empty) + 2: R_CURLY@1201..1202 "}" [] [] + 2: TS_TEMPLATE_CHUNK_ELEMENT@1202..1203 + 0: TEMPLATE_CHUNK@1202..1203 "*" [] [] + 2: BACKTICK@1203..1205 "`" [] [Whitespace(" ")] + 3: QUESTION@1205..1207 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1207..1209 + 0: JS_REFERENCE_IDENTIFIER@1207..1209 + 0: IDENT@1207..1209 "S" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1209..1211 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1211..1216 + 0: NEVER_KW@1211..1216 "never" [] [] + 5: SEMICOLON@1216..1217 ";" [] [] + 14: TS_TYPE_ALIAS_DECLARATION@1217..1356 + 0: TYPE_KW@1217..1223 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1223..1231 + 0: IDENT@1223..1231 "Unpacked" [] [] + 2: TS_TYPE_PARAMETERS@1231..1235 + 0: L_ANGLE@1231..1232 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1232..1233 + 0: TS_TYPE_PARAMETER@1232..1233 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1232..1232 + 1: TS_TYPE_PARAMETER_NAME@1232..1233 + 0: IDENT@1232..1233 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1233..1235 ">" [] [Whitespace(" ")] + 3: EQ@1235..1237 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1237..1355 + 0: TS_REFERENCE_TYPE@1237..1239 + 0: JS_REFERENCE_IDENTIFIER@1237..1239 + 0: IDENT@1237..1239 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1239..1247 "extends" [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1247..1259 + 0: TS_PARENTHESIZED_TYPE@1247..1256 + 0: L_PAREN@1247..1248 "(" [] [] + 1: TS_INFER_TYPE@1248..1255 + 0: INFER_KW@1248..1254 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1254..1255 + 0: IDENT@1254..1255 "U" [] [] + 2: (empty) + 2: R_PAREN@1255..1256 ")" [] [] + 1: L_BRACK@1256..1257 "[" [] [] + 2: R_BRACK@1257..1259 "]" [] [Whitespace(" ")] + 3: QUESTION@1259..1261 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1261..1263 + 0: JS_REFERENCE_IDENTIFIER@1261..1263 + 0: IDENT@1261..1263 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1263..1264 ":" [] [] + 6: TS_CONDITIONAL_TYPE@1264..1355 + 0: TS_REFERENCE_TYPE@1264..1271 + 0: JS_REFERENCE_IDENTIFIER@1264..1271 + 0: IDENT@1264..1271 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1271..1279 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@1279..1307 + 0: (empty) + 1: JS_PARAMETERS@1279..1296 + 0: L_PAREN@1279..1280 "(" [] [] + 1: JS_PARAMETER_LIST@1280..1294 + 0: JS_REST_PARAMETER@1280..1294 + 0: JS_DECORATOR_LIST@1280..1280 + 1: DOT3@1280..1283 "..." [] [] + 2: JS_IDENTIFIER_BINDING@1283..1287 + 0: IDENT@1283..1287 "args" [] [] + 3: TS_TYPE_ANNOTATION@1287..1294 + 0: COLON@1287..1289 ":" [] [Whitespace(" ")] + 1: TS_ARRAY_TYPE@1289..1294 + 0: TS_ANY_TYPE@1289..1292 + 0: ANY_KW@1289..1292 "any" [] [] + 1: L_BRACK@1292..1293 "[" [] [] + 2: R_BRACK@1293..1294 "]" [] [] + 2: R_PAREN@1294..1296 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1296..1299 "=>" [] [Whitespace(" ")] + 3: TS_INFER_TYPE@1299..1307 + 0: INFER_KW@1299..1305 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1305..1307 + 0: IDENT@1305..1307 "U" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1307..1309 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1309..1311 + 0: JS_REFERENCE_IDENTIFIER@1309..1311 + 0: IDENT@1309..1311 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1311..1312 ":" [] [] + 6: TS_CONDITIONAL_TYPE@1312..1355 + 0: TS_REFERENCE_TYPE@1312..1319 + 0: JS_REFERENCE_IDENTIFIER@1312..1319 + 0: IDENT@1312..1319 "T" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1319..1327 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1327..1344 + 0: JS_REFERENCE_IDENTIFIER@1327..1334 + 0: IDENT@1327..1334 "Promise" [] [] + 1: TS_TYPE_ARGUMENTS@1334..1344 + 0: L_ANGLE@1334..1335 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1335..1342 + 0: TS_INFER_TYPE@1335..1342 + 0: INFER_KW@1335..1341 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1341..1342 + 0: IDENT@1341..1342 "U" [] [] + 2: (empty) + 2: R_ANGLE@1342..1344 ">" [] [Whitespace(" ")] + 3: QUESTION@1344..1346 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1346..1348 + 0: JS_REFERENCE_IDENTIFIER@1346..1348 + 0: IDENT@1346..1348 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1348..1349 ":" [] [] + 6: TS_REFERENCE_TYPE@1349..1355 + 0: JS_REFERENCE_IDENTIFIER@1349..1355 + 0: IDENT@1349..1355 "T" [Newline("\n"), Whitespace(" ")] [] + 1: (empty) + 5: SEMICOLON@1355..1356 ";" [] [] + 15: TS_TYPE_ALIAS_DECLARATION@1356..1444 + 0: TYPE_KW@1356..1362 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1362..1374 + 0: IDENT@1362..1374 "ArgumentType" [] [] + 2: TS_TYPE_PARAMETERS@1374..1402 + 0: L_ANGLE@1374..1375 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1375..1400 + 0: TS_TYPE_PARAMETER@1375..1400 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1375..1375 + 1: TS_TYPE_PARAMETER_NAME@1375..1377 + 0: IDENT@1375..1377 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1377..1400 + 0: EXTENDS_KW@1377..1385 "extends" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1385..1400 + 0: (empty) + 1: JS_PARAMETERS@1385..1394 + 0: L_PAREN@1385..1386 "(" [] [] + 1: JS_PARAMETER_LIST@1386..1392 + 0: JS_FORMAL_PARAMETER@1386..1392 + 0: JS_DECORATOR_LIST@1386..1386 + 1: JS_IDENTIFIER_BINDING@1386..1387 + 0: IDENT@1386..1387 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1387..1392 + 0: COLON@1387..1389 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1389..1392 + 0: ANY_KW@1389..1392 "any" [] [] + 4: (empty) + 2: R_PAREN@1392..1394 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1394..1397 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@1397..1400 + 0: ANY_KW@1397..1400 "any" [] [] + 3: (empty) + 2: R_ANGLE@1400..1402 ">" [] [Whitespace(" ")] + 3: EQ@1402..1404 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1404..1443 + 0: TS_REFERENCE_TYPE@1404..1406 + 0: JS_REFERENCE_IDENTIFIER@1404..1406 + 0: IDENT@1404..1406 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1406..1414 "extends" [] [Whitespace(" ")] + 2: TS_FUNCTION_TYPE@1414..1434 + 0: (empty) + 1: JS_PARAMETERS@1414..1427 + 0: L_PAREN@1414..1415 "(" [] [] + 1: JS_PARAMETER_LIST@1415..1425 + 0: JS_FORMAL_PARAMETER@1415..1425 + 0: JS_DECORATOR_LIST@1415..1415 + 1: JS_IDENTIFIER_BINDING@1415..1416 + 0: IDENT@1415..1416 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1416..1425 + 0: COLON@1416..1418 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1418..1425 + 0: INFER_KW@1418..1424 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1424..1425 + 0: IDENT@1424..1425 "A" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1425..1427 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1427..1430 "=>" [] [Whitespace(" ")] + 3: TS_ANY_TYPE@1430..1434 + 0: ANY_KW@1430..1434 "any" [] [Whitespace(" ")] + 3: QUESTION@1434..1436 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1436..1438 + 0: JS_REFERENCE_IDENTIFIER@1436..1438 + 0: IDENT@1436..1438 "A" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1438..1440 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@1440..1443 + 0: ANY_KW@1440..1443 "any" [] [] + 5: SEMICOLON@1443..1444 ";" [] [] + 16: TS_TYPE_ALIAS_DECLARATION@1444..1533 + 0: TYPE_KW@1444..1450 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1450..1452 + 0: IDENT@1450..1452 "X3" [] [] + 2: TS_TYPE_PARAMETERS@1452..1456 + 0: L_ANGLE@1452..1453 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1453..1454 + 0: TS_TYPE_PARAMETER@1453..1454 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1453..1453 + 1: TS_TYPE_PARAMETER_NAME@1453..1454 + 0: IDENT@1453..1454 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1454..1456 ">" [] [Whitespace(" ")] + 3: EQ@1456..1458 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1458..1532 + 0: TS_REFERENCE_TYPE@1458..1460 + 0: JS_REFERENCE_IDENTIFIER@1458..1460 + 0: IDENT@1458..1460 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1460..1468 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@1468..1521 + 0: L_CURLY@1468..1470 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1470..1519 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1470..1495 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1470..1471 + 0: IDENT@1470..1471 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1471..1493 + 0: COLON@1471..1473 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1473..1493 + 0: (empty) + 1: JS_PARAMETERS@1473..1486 + 0: L_PAREN@1473..1474 "(" [] [] + 1: JS_PARAMETER_LIST@1474..1484 + 0: JS_FORMAL_PARAMETER@1474..1484 + 0: JS_DECORATOR_LIST@1474..1474 + 1: JS_IDENTIFIER_BINDING@1474..1475 + 0: IDENT@1474..1475 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1475..1484 + 0: COLON@1475..1477 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1477..1484 + 0: INFER_KW@1477..1483 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1483..1484 + 0: IDENT@1483..1484 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1484..1486 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1486..1489 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@1489..1493 + 0: VOID_KW@1489..1493 "void" [] [] + 4: COMMA@1493..1495 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1495..1519 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1495..1496 + 0: IDENT@1495..1496 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1496..1519 + 0: COLON@1496..1498 ":" [] [Whitespace(" ")] + 1: TS_FUNCTION_TYPE@1498..1519 + 0: (empty) + 1: JS_PARAMETERS@1498..1511 + 0: L_PAREN@1498..1499 "(" [] [] + 1: JS_PARAMETER_LIST@1499..1509 + 0: JS_FORMAL_PARAMETER@1499..1509 + 0: JS_DECORATOR_LIST@1499..1499 + 1: JS_IDENTIFIER_BINDING@1499..1500 + 0: IDENT@1499..1500 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1500..1509 + 0: COLON@1500..1502 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1502..1509 + 0: INFER_KW@1502..1508 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1508..1509 + 0: IDENT@1508..1509 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_PAREN@1509..1511 ")" [] [Whitespace(" ")] + 2: FAT_ARROW@1511..1514 "=>" [] [Whitespace(" ")] + 3: TS_VOID_TYPE@1514..1519 + 0: VOID_KW@1514..1519 "void" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@1519..1521 "}" [] [Whitespace(" ")] + 3: QUESTION@1521..1523 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1523..1525 + 0: JS_REFERENCE_IDENTIFIER@1523..1525 + 0: IDENT@1523..1525 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1525..1527 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1527..1532 + 0: NEVER_KW@1527..1532 "never" [] [] + 5: SEMICOLON@1532..1533 ";" [] [] + 17: TS_TYPE_ALIAS_DECLARATION@1533..1626 + 0: TYPE_KW@1533..1539 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1539..1541 + 0: IDENT@1539..1541 "X1" [] [] + 2: TS_TYPE_PARAMETERS@1541..1572 + 0: L_ANGLE@1541..1542 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1542..1570 + 0: TS_TYPE_PARAMETER@1542..1570 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1542..1542 + 1: TS_TYPE_PARAMETER_NAME@1542..1544 + 0: IDENT@1542..1544 "T" [] [Whitespace(" ")] + 2: TS_TYPE_CONSTRAINT_CLAUSE@1544..1570 + 0: EXTENDS_KW@1544..1552 "extends" [] [Whitespace(" ")] + 1: TS_OBJECT_TYPE@1552..1570 + 0: L_CURLY@1552..1554 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1554..1569 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1554..1562 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1554..1555 + 0: IDENT@1554..1555 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1555..1560 + 0: COLON@1555..1557 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1557..1560 + 0: ANY_KW@1557..1560 "any" [] [] + 4: COMMA@1560..1562 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1562..1569 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1562..1563 + 0: IDENT@1562..1563 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1563..1569 + 0: COLON@1563..1565 ":" [] [Whitespace(" ")] + 1: TS_ANY_TYPE@1565..1569 + 0: ANY_KW@1565..1569 "any" [] [Whitespace(" ")] + 4: (empty) + 2: R_CURLY@1569..1570 "}" [] [] + 3: (empty) + 2: R_ANGLE@1570..1572 ">" [] [Whitespace(" ")] + 3: EQ@1572..1574 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1574..1625 + 0: TS_REFERENCE_TYPE@1574..1576 + 0: JS_REFERENCE_IDENTIFIER@1574..1576 + 0: IDENT@1574..1576 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1576..1584 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@1584..1611 + 0: L_CURLY@1584..1586 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1586..1609 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1586..1598 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1586..1587 + 0: IDENT@1586..1587 "x" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1587..1596 + 0: COLON@1587..1589 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1589..1596 + 0: INFER_KW@1589..1595 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1595..1596 + 0: IDENT@1595..1596 "X" [] [] + 2: (empty) + 4: COMMA@1596..1598 "," [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@1598..1609 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@1598..1599 + 0: IDENT@1598..1599 "y" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@1599..1609 + 0: COLON@1599..1601 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1601..1609 + 0: INFER_KW@1601..1607 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1607..1609 + 0: IDENT@1607..1609 "Y" [] [Whitespace(" ")] + 2: (empty) + 4: (empty) + 2: R_CURLY@1609..1611 "}" [] [Whitespace(" ")] + 3: QUESTION@1611..1613 "?" [] [Whitespace(" ")] + 4: TS_TUPLE_TYPE@1613..1620 + 0: L_BRACK@1613..1614 "[" [] [] + 1: TS_TUPLE_TYPE_ELEMENT_LIST@1614..1618 + 0: TS_REFERENCE_TYPE@1614..1615 + 0: JS_REFERENCE_IDENTIFIER@1614..1615 + 0: IDENT@1614..1615 "X" [] [] + 1: (empty) + 1: COMMA@1615..1617 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1617..1618 + 0: JS_REFERENCE_IDENTIFIER@1617..1618 + 0: IDENT@1617..1618 "Y" [] [] + 1: (empty) + 2: R_BRACK@1618..1620 "]" [] [Whitespace(" ")] + 5: COLON@1620..1622 ":" [] [Whitespace(" ")] + 6: TS_ANY_TYPE@1622..1625 + 0: ANY_KW@1622..1625 "any" [] [] + 5: SEMICOLON@1625..1626 ";" [] [] + 18: TS_TYPE_ALIAS_DECLARATION@1626..1671 + 0: TYPE_KW@1626..1632 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1632..1635 + 0: IDENT@1632..1635 "T62" [] [] + 2: TS_TYPE_PARAMETERS@1635..1639 + 0: L_ANGLE@1635..1636 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1636..1637 + 0: TS_TYPE_PARAMETER@1636..1637 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1636..1636 + 1: TS_TYPE_PARAMETER_NAME@1636..1637 + 0: IDENT@1636..1637 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1637..1639 ">" [] [Whitespace(" ")] + 3: EQ@1639..1641 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1641..1670 + 0: TS_REFERENCE_TYPE@1641..1643 + 0: JS_REFERENCE_IDENTIFIER@1641..1643 + 0: IDENT@1641..1643 "U" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1643..1651 "extends" [] [Whitespace(" ")] + 2: TS_ARRAY_TYPE@1651..1663 + 0: TS_PARENTHESIZED_TYPE@1651..1660 + 0: L_PAREN@1651..1652 "(" [] [] + 1: TS_INFER_TYPE@1652..1659 + 0: INFER_KW@1652..1658 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1658..1659 + 0: IDENT@1658..1659 "U" [] [] + 2: (empty) + 2: R_PAREN@1659..1660 ")" [] [] + 1: L_BRACK@1660..1661 "[" [] [] + 2: R_BRACK@1661..1663 "]" [] [Whitespace(" ")] + 3: QUESTION@1663..1665 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1665..1667 + 0: JS_REFERENCE_IDENTIFIER@1665..1667 + 0: IDENT@1665..1667 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@1667..1669 ":" [] [Whitespace(" ")] + 6: TS_REFERENCE_TYPE@1669..1670 + 0: JS_REFERENCE_IDENTIFIER@1669..1670 + 0: IDENT@1669..1670 "U" [] [] + 1: (empty) + 5: SEMICOLON@1670..1671 ";" [] [] + 19: TS_TYPE_ALIAS_DECLARATION@1671..1762 + 0: TYPE_KW@1671..1677 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1677..1680 + 0: IDENT@1677..1680 "T63" [] [] + 2: TS_TYPE_PARAMETERS@1680..1684 + 0: L_ANGLE@1680..1681 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1681..1682 + 0: TS_TYPE_PARAMETER@1681..1682 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1681..1681 + 1: TS_TYPE_PARAMETER_NAME@1681..1682 + 0: IDENT@1681..1682 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1682..1684 ">" [] [Whitespace(" ")] + 3: EQ@1684..1686 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1686..1761 + 0: TS_REFERENCE_TYPE@1686..1688 + 0: JS_REFERENCE_IDENTIFIER@1686..1688 + 0: IDENT@1686..1688 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1688..1696 "extends" [] [Whitespace(" ")] + 2: TS_PARENTHESIZED_TYPE@1696..1744 + 0: L_PAREN@1696..1697 "(" [] [] + 1: TS_CONDITIONAL_TYPE@1697..1742 + 0: TS_PARENTHESIZED_TYPE@1697..1707 + 0: L_PAREN@1697..1698 "(" [] [] + 1: TS_INFER_TYPE@1698..1705 + 0: INFER_KW@1698..1704 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1704..1705 + 0: IDENT@1704..1705 "A" [] [] + 2: (empty) + 2: R_PAREN@1705..1707 ")" [] [Whitespace(" ")] + 1: EXTENDS_KW@1707..1715 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1715..1723 + 0: INFER_KW@1715..1721 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1721..1723 + 0: IDENT@1721..1723 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@1723..1725 "?" [] [Whitespace(" ")] + 4: TS_INFER_TYPE@1725..1733 + 0: INFER_KW@1725..1731 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1731..1733 + 0: IDENT@1731..1733 "C" [] [Whitespace(" ")] + 2: (empty) + 5: COLON@1733..1735 ":" [] [Whitespace(" ")] + 6: TS_INFER_TYPE@1735..1742 + 0: INFER_KW@1735..1741 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1741..1742 + 0: IDENT@1741..1742 "D" [] [] + 2: (empty) + 2: R_PAREN@1742..1744 ")" [] [Whitespace(" ")] + 3: QUESTION@1744..1746 "?" [] [Whitespace(" ")] + 4: TS_STRING_TYPE@1746..1753 + 0: STRING_KW@1746..1753 "string" [] [Whitespace(" ")] + 5: COLON@1753..1755 ":" [] [Whitespace(" ")] + 6: TS_NUMBER_TYPE@1755..1761 + 0: NUMBER_KW@1755..1761 "number" [] [] + 5: SEMICOLON@1761..1762 ";" [] [] + 20: TS_TYPE_ALIAS_DECLARATION@1762..1847 + 0: TYPE_KW@1762..1768 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1768..1771 + 0: IDENT@1768..1771 "T75" [] [] + 2: TS_TYPE_PARAMETERS@1771..1775 + 0: L_ANGLE@1771..1772 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1772..1773 + 0: TS_TYPE_PARAMETER@1772..1773 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1772..1772 + 1: TS_TYPE_PARAMETER_NAME@1772..1773 + 0: IDENT@1772..1773 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1773..1775 ">" [] [Whitespace(" ")] + 3: EQ@1775..1777 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1777..1846 + 0: TS_REFERENCE_TYPE@1777..1779 + 0: JS_REFERENCE_IDENTIFIER@1777..1779 + 0: IDENT@1777..1779 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1779..1787 "extends" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1787..1809 + 0: JS_REFERENCE_IDENTIFIER@1787..1790 + 0: IDENT@1787..1790 "T74" [] [] + 1: TS_TYPE_ARGUMENTS@1790..1809 + 0: L_ANGLE@1790..1791 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1791..1807 + 0: TS_INFER_TYPE@1791..1798 + 0: INFER_KW@1791..1797 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1797..1798 + 0: IDENT@1797..1798 "U" [] [] + 2: (empty) + 1: COMMA@1798..1800 "," [] [Whitespace(" ")] + 2: TS_INFER_TYPE@1800..1807 + 0: INFER_KW@1800..1806 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1806..1807 + 0: IDENT@1806..1807 "U" [] [] + 2: (empty) + 2: R_ANGLE@1807..1809 ">" [] [Whitespace(" ")] + 3: QUESTION@1809..1811 "?" [] [Whitespace(" ")] + 4: TS_UNION_TYPE@1811..1839 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1811..1839 + 0: TS_REFERENCE_TYPE@1811..1818 + 0: JS_REFERENCE_IDENTIFIER@1811..1814 + 0: IDENT@1811..1814 "T70" [] [] + 1: TS_TYPE_ARGUMENTS@1814..1818 + 0: L_ANGLE@1814..1815 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1815..1816 + 0: TS_REFERENCE_TYPE@1815..1816 + 0: JS_REFERENCE_IDENTIFIER@1815..1816 + 0: IDENT@1815..1816 "U" [] [] + 1: (empty) + 2: R_ANGLE@1816..1818 ">" [] [Whitespace(" ")] + 1: PIPE@1818..1820 "|" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1820..1827 + 0: JS_REFERENCE_IDENTIFIER@1820..1823 + 0: IDENT@1820..1823 "T72" [] [] + 1: TS_TYPE_ARGUMENTS@1823..1827 + 0: L_ANGLE@1823..1824 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1824..1825 + 0: TS_REFERENCE_TYPE@1824..1825 + 0: JS_REFERENCE_IDENTIFIER@1824..1825 + 0: IDENT@1824..1825 "U" [] [] + 1: (empty) + 2: R_ANGLE@1825..1827 ">" [] [Whitespace(" ")] + 3: PIPE@1827..1829 "|" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1829..1839 + 0: JS_REFERENCE_IDENTIFIER@1829..1832 + 0: IDENT@1829..1832 "T74" [] [] + 1: TS_TYPE_ARGUMENTS@1832..1839 + 0: L_ANGLE@1832..1833 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@1833..1837 + 0: TS_REFERENCE_TYPE@1833..1834 + 0: JS_REFERENCE_IDENTIFIER@1833..1834 + 0: IDENT@1833..1834 "U" [] [] + 1: (empty) + 1: COMMA@1834..1836 "," [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1836..1837 + 0: JS_REFERENCE_IDENTIFIER@1836..1837 + 0: IDENT@1836..1837 "U" [] [] + 1: (empty) + 2: R_ANGLE@1837..1839 ">" [] [Whitespace(" ")] + 5: COLON@1839..1841 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@1841..1846 + 0: NEVER_KW@1841..1846 "never" [] [] + 5: SEMICOLON@1846..1847 ";" [] [] + 21: TS_TYPE_ALIAS_DECLARATION@1847..2063 + 0: TYPE_KW@1847..1853 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@1853..1862 + 0: IDENT@1853..1862 "Jsonified" [] [] + 2: TS_TYPE_PARAMETERS@1862..1866 + 0: L_ANGLE@1862..1863 "<" [] [] + 1: TS_TYPE_PARAMETER_LIST@1863..1864 + 0: TS_TYPE_PARAMETER@1863..1864 + 0: TS_TYPE_PARAMETER_MODIFIER_LIST@1863..1863 + 1: TS_TYPE_PARAMETER_NAME@1863..1864 + 0: IDENT@1863..1864 "T" [] [] + 2: (empty) + 3: (empty) + 2: R_ANGLE@1864..1866 ">" [] [Whitespace(" ")] + 3: EQ@1866..1868 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@1868..2062 + 0: TS_REFERENCE_TYPE@1868..1870 + 0: JS_REFERENCE_IDENTIFIER@1868..1870 + 0: IDENT@1868..1870 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1870..1878 "extends" [] [Whitespace(" ")] + 2: TS_UNION_TYPE@1878..1911 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1878..1911 + 0: TS_STRING_TYPE@1878..1885 + 0: STRING_KW@1878..1885 "string" [] [Whitespace(" ")] + 1: PIPE@1885..1887 "|" [] [Whitespace(" ")] + 2: TS_NUMBER_TYPE@1887..1894 + 0: NUMBER_KW@1887..1894 "number" [] [Whitespace(" ")] + 3: PIPE@1894..1896 "|" [] [Whitespace(" ")] + 4: TS_BOOLEAN_TYPE@1896..1904 + 0: BOOLEAN_KW@1896..1904 "boolean" [] [Whitespace(" ")] + 5: PIPE@1904..1906 "|" [] [Whitespace(" ")] + 6: TS_NULL_LITERAL_TYPE@1906..1911 + 0: NULL_KW@1906..1911 "null" [] [Whitespace(" ")] + 3: QUESTION@1911..1913 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@1913..1914 + 0: JS_REFERENCE_IDENTIFIER@1913..1914 + 0: IDENT@1913..1914 "T" [] [] + 1: (empty) + 5: COLON@1914..1921 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@1921..2062 + 0: TS_REFERENCE_TYPE@1921..1923 + 0: JS_REFERENCE_IDENTIFIER@1921..1923 + 0: IDENT@1921..1923 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1923..1931 "extends" [] [Whitespace(" ")] + 2: TS_UNION_TYPE@1931..1952 + 0: (empty) + 1: TS_UNION_TYPE_VARIANT_LIST@1931..1952 + 0: TS_UNDEFINED_TYPE@1931..1941 + 0: UNDEFINED_KW@1931..1941 "undefined" [] [Whitespace(" ")] + 1: PIPE@1941..1943 "|" [] [Whitespace(" ")] + 2: TS_REFERENCE_TYPE@1943..1952 + 0: JS_REFERENCE_IDENTIFIER@1943..1952 + 0: IDENT@1943..1952 "Function" [] [Whitespace(" ")] + 1: (empty) + 3: QUESTION@1952..1954 "?" [] [Whitespace(" ")] + 4: TS_NEVER_TYPE@1954..1959 + 0: NEVER_KW@1954..1959 "never" [] [] + 5: COLON@1959..1966 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@1966..2062 + 0: TS_REFERENCE_TYPE@1966..1968 + 0: JS_REFERENCE_IDENTIFIER@1966..1968 + 0: IDENT@1966..1968 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@1968..1976 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@1976..1998 + 0: L_CURLY@1976..1978 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@1978..1996 + 0: TS_METHOD_SIGNATURE_TYPE_MEMBER@1978..1996 + 0: JS_LITERAL_MEMBER_NAME@1978..1984 + 0: IDENT@1978..1984 "toJSON" [] [] + 1: (empty) + 2: (empty) + 3: JS_PARAMETERS@1984..1986 + 0: L_PAREN@1984..1985 "(" [] [] + 1: JS_PARAMETER_LIST@1985..1985 + 2: R_PAREN@1985..1986 ")" [] [] + 4: TS_RETURN_TYPE_ANNOTATION@1986..1996 + 0: COLON@1986..1988 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@1988..1996 + 0: INFER_KW@1988..1994 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@1994..1996 + 0: IDENT@1994..1996 "R" [] [Whitespace(" ")] + 2: (empty) + 5: (empty) + 2: R_CURLY@1996..1998 "}" [] [Whitespace(" ")] + 3: QUESTION@1998..2000 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2000..2001 + 0: JS_REFERENCE_IDENTIFIER@2000..2001 + 0: IDENT@2000..2001 "R" [] [] + 1: (empty) + 5: COLON@2001..2008 ":" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 6: TS_CONDITIONAL_TYPE@2008..2062 + 0: TS_REFERENCE_TYPE@2008..2010 + 0: JS_REFERENCE_IDENTIFIER@2008..2010 + 0: IDENT@2008..2010 "T" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@2010..2018 "extends" [] [Whitespace(" ")] + 2: TS_NON_PRIMITIVE_TYPE@2018..2025 + 0: OBJECT_KW@2018..2025 "object" [] [Whitespace(" ")] + 3: QUESTION@2025..2027 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@2027..2045 + 0: JS_REFERENCE_IDENTIFIER@2027..2042 + 0: IDENT@2027..2042 "JsonifiedObject" [] [] + 1: TS_TYPE_ARGUMENTS@2042..2045 + 0: L_ANGLE@2042..2043 "<" [] [] + 1: TS_TYPE_ARGUMENT_LIST@2043..2044 + 0: TS_REFERENCE_TYPE@2043..2044 + 0: JS_REFERENCE_IDENTIFIER@2043..2044 + 0: IDENT@2043..2044 "T" [] [] + 1: (empty) + 2: R_ANGLE@2044..2045 ">" [] [] + 5: COLON@2045..2048 ":" [Newline("\n")] [Whitespace(" ")] + 6: TS_STRING_LITERAL_TYPE@2048..2062 + 0: JS_STRING_LITERAL@2048..2062 "\"what is this\"" [] [] + 5: SEMICOLON@2062..2063 ";" [] [] + 3: EOF@2063..2064 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts b/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts new file mode 100644 index 000000000000..97d85a9e13f0 --- /dev/null +++ b/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts @@ -0,0 +1,37 @@ +type A = T extends import("test").C ? P : never +type A = T extends typeof Array ? P : never +type A = T extends { set(a: infer P): number } ? P : never +type A = T extends { get(): infer P } ? P : never +type A = T extends { method(this: infer P): number } ? P : never +type valid9 = T extends Array ? R : any; +type ContentBetweenBrackets = S extends `[${infer T}]` ? T : never; +type WithSelectors = S extends { getState: () => infer T } + ? S & { use: { [K in keyof T]: () => T[K] } } + : never; +type A = MyType extends (OtherType extends infer T ? infer U : InnerFalse) ? OuterTrue : OuterFalse +type Join = + T extends [] ? '' : + T extends [string | number | boolean | bigint] ? `${T[0]}` : + T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : + string; +type MatchPair = S extends `[${infer A},${infer B}]` ? [A, B] : unknown; +type FirstTwoAndRest = S extends `${infer A}${infer B}${infer R}` ? [`${A}${B}`, R] : unknown; +type Trim = + S extends `${infer T} ` ? Trim : + S; +type Foo = T extends `*${infer S}*` ? S : never; +type Unpacked = T extends (infer U)[] ? U : + T extends (...args: any[]) => infer U ? U : + T extends Promise ? U : + T; +type ArgumentType any> = T extends (a: infer A) => any ? A : any; +type X3 = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U : never; +type X1 = T extends { x: infer X, y: infer Y } ? [X, Y] : any; +type T62 = U extends (infer U)[] ? U : U; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; +type T75 = T extends T74 ? T70 | T72 | T74 : never; +type Jsonified = T extends string | number | boolean | null ? T + : T extends undefined | Function ? never + : T extends { toJSON(): infer R } ? R + : T extends object ? JsonifiedObject +: "what is this"; diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast b/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast index c79a0aa0750e..d9db0860e5ea 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast +++ b/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast @@ -9,121 +9,189 @@ JsModule { }, type_parameters: missing (optional), eq_token: EQ@7..9 "=" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@9..15 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@15..16 "B" [] [], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@9..11 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")], + extends_type: TsInferType { + infer_token: INFER_KW@19..25 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@25..27 "B" [] [Whitespace(" ")], + }, + constraint: missing (optional), + }, + question_mark_token: QUESTION@27..29 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@29..31 "B" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + colon_token: COLON@31..33 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@33..38 "never" [] [], }, - constraint: missing (optional), }, - semicolon_token: SEMICOLON@16..17 ";" [] [], + semicolon_token: SEMICOLON@38..39 ";" [] [], }, TsTypeAliasDeclaration { - type_token: TYPE_KW@17..23 "type" [Newline("\n")] [Whitespace(" ")], + type_token: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")], binding_identifier: TsIdentifierBinding { - name_token: IDENT@23..25 "B" [] [Whitespace(" ")], + name_token: IDENT@45..47 "B" [] [Whitespace(" ")], }, type_parameters: missing (optional), - eq_token: EQ@25..27 "=" [] [Whitespace(" ")], - ty: TsObjectType { - l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], - members: TsTypeMemberList [ - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@29..30 "a" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@30..32 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@32..38 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@38..39 "U" [] [], + eq_token: EQ@47..49 "=" [] [Whitespace(" ")], + ty: TsConditionalType { + check_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@49..51 "A" [] [Whitespace(" ")], + }, + type_arguments: missing (optional), + }, + extends_token: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")], + extends_type: TsObjectType { + l_curly_token: L_CURLY@59..61 "{" [] [Whitespace(" ")], + members: TsTypeMemberList [ + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@61..62 "a" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@62..64 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@64..70 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@70..71 "U" [] [], + }, + constraint: missing (optional), }, - constraint: missing (optional), }, + separator_token: SEMICOLON@71..73 ";" [] [Whitespace(" ")], }, - separator_token: SEMICOLON@39..41 ";" [] [Whitespace(" ")], - }, - TsPropertySignatureTypeMember { - readonly_token: missing (optional), - name: JsLiteralMemberName { - value: IDENT@41..42 "b" [] [], - }, - optional_token: missing (optional), - type_annotation: TsTypeAnnotation { - colon_token: COLON@42..44 ":" [] [Whitespace(" ")], - ty: TsInferType { - infer_token: INFER_KW@44..50 "infer" [] [Whitespace(" ")], - name: TsTypeParameterName { - ident_token: IDENT@50..51 "U" [] [], + TsPropertySignatureTypeMember { + readonly_token: missing (optional), + name: JsLiteralMemberName { + value: IDENT@73..74 "b" [] [], + }, + optional_token: missing (optional), + type_annotation: TsTypeAnnotation { + colon_token: COLON@74..76 ":" [] [Whitespace(" ")], + ty: TsInferType { + infer_token: INFER_KW@76..82 "infer" [] [Whitespace(" ")], + name: TsTypeParameterName { + ident_token: IDENT@82..83 "U" [] [], + }, + constraint: missing (optional), }, - constraint: missing (optional), }, + separator_token: missing (optional), }, - separator_token: missing (optional), + ], + r_curly_token: R_CURLY@83..85 "}" [] [Whitespace(" ")], + }, + question_mark_token: QUESTION@85..87 "?" [] [Whitespace(" ")], + true_type: TsReferenceType { + name: JsReferenceIdentifier { + value_token: IDENT@87..89 "U" [] [Whitespace(" ")], }, - ], - r_curly_token: R_CURLY@51..52 "}" [] [], + type_arguments: missing (optional), + }, + colon_token: COLON@89..91 ":" [] [Whitespace(" ")], + false_type: TsNeverType { + never_token: NEVER_KW@91..96 "never" [] [], + }, }, - semicolon_token: SEMICOLON@52..53 ";" [] [], + semicolon_token: SEMICOLON@96..97 ";" [] [], }, ], - eof_token: EOF@53..54 "" [Newline("\n")] [], + eof_token: EOF@97..98 "" [Newline("\n")] [], } -0: JS_MODULE@0..54 +0: JS_MODULE@0..98 0: (empty) 1: JS_DIRECTIVE_LIST@0..0 - 2: JS_MODULE_ITEM_LIST@0..53 - 0: TS_TYPE_ALIAS_DECLARATION@0..17 + 2: JS_MODULE_ITEM_LIST@0..97 + 0: TS_TYPE_ALIAS_DECLARATION@0..39 0: TYPE_KW@0..5 "type" [] [Whitespace(" ")] 1: TS_IDENTIFIER_BINDING@5..7 0: IDENT@5..7 "A" [] [Whitespace(" ")] 2: (empty) 3: EQ@7..9 "=" [] [Whitespace(" ")] - 4: TS_INFER_TYPE@9..16 - 0: INFER_KW@9..15 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@15..16 - 0: IDENT@15..16 "B" [] [] - 2: (empty) - 5: SEMICOLON@16..17 ";" [] [] - 1: TS_TYPE_ALIAS_DECLARATION@17..53 - 0: TYPE_KW@17..23 "type" [Newline("\n")] [Whitespace(" ")] - 1: TS_IDENTIFIER_BINDING@23..25 - 0: IDENT@23..25 "B" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@9..38 + 0: TS_REFERENCE_TYPE@9..11 + 0: JS_REFERENCE_IDENTIFIER@9..11 + 0: IDENT@9..11 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@11..19 "extends" [] [Whitespace(" ")] + 2: TS_INFER_TYPE@19..27 + 0: INFER_KW@19..25 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@25..27 + 0: IDENT@25..27 "B" [] [Whitespace(" ")] + 2: (empty) + 3: QUESTION@27..29 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@29..31 + 0: JS_REFERENCE_IDENTIFIER@29..31 + 0: IDENT@29..31 "B" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@31..33 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@33..38 + 0: NEVER_KW@33..38 "never" [] [] + 5: SEMICOLON@38..39 ";" [] [] + 1: TS_TYPE_ALIAS_DECLARATION@39..97 + 0: TYPE_KW@39..45 "type" [Newline("\n")] [Whitespace(" ")] + 1: TS_IDENTIFIER_BINDING@45..47 + 0: IDENT@45..47 "B" [] [Whitespace(" ")] 2: (empty) - 3: EQ@25..27 "=" [] [Whitespace(" ")] - 4: TS_OBJECT_TYPE@27..52 - 0: L_CURLY@27..29 "{" [] [Whitespace(" ")] - 1: TS_TYPE_MEMBER_LIST@29..51 - 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@29..41 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@29..30 - 0: IDENT@29..30 "a" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@30..39 - 0: COLON@30..32 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@32..39 - 0: INFER_KW@32..38 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@38..39 - 0: IDENT@38..39 "U" [] [] - 2: (empty) - 4: SEMICOLON@39..41 ";" [] [Whitespace(" ")] - 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@41..51 - 0: (empty) - 1: JS_LITERAL_MEMBER_NAME@41..42 - 0: IDENT@41..42 "b" [] [] - 2: (empty) - 3: TS_TYPE_ANNOTATION@42..51 - 0: COLON@42..44 ":" [] [Whitespace(" ")] - 1: TS_INFER_TYPE@44..51 - 0: INFER_KW@44..50 "infer" [] [Whitespace(" ")] - 1: TS_TYPE_PARAMETER_NAME@50..51 - 0: IDENT@50..51 "U" [] [] - 2: (empty) - 4: (empty) - 2: R_CURLY@51..52 "}" [] [] - 5: SEMICOLON@52..53 ";" [] [] - 3: EOF@53..54 "" [Newline("\n")] [] + 3: EQ@47..49 "=" [] [Whitespace(" ")] + 4: TS_CONDITIONAL_TYPE@49..96 + 0: TS_REFERENCE_TYPE@49..51 + 0: JS_REFERENCE_IDENTIFIER@49..51 + 0: IDENT@49..51 "A" [] [Whitespace(" ")] + 1: (empty) + 1: EXTENDS_KW@51..59 "extends" [] [Whitespace(" ")] + 2: TS_OBJECT_TYPE@59..85 + 0: L_CURLY@59..61 "{" [] [Whitespace(" ")] + 1: TS_TYPE_MEMBER_LIST@61..83 + 0: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@61..73 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@61..62 + 0: IDENT@61..62 "a" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@62..71 + 0: COLON@62..64 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@64..71 + 0: INFER_KW@64..70 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@70..71 + 0: IDENT@70..71 "U" [] [] + 2: (empty) + 4: SEMICOLON@71..73 ";" [] [Whitespace(" ")] + 1: TS_PROPERTY_SIGNATURE_TYPE_MEMBER@73..83 + 0: (empty) + 1: JS_LITERAL_MEMBER_NAME@73..74 + 0: IDENT@73..74 "b" [] [] + 2: (empty) + 3: TS_TYPE_ANNOTATION@74..83 + 0: COLON@74..76 ":" [] [Whitespace(" ")] + 1: TS_INFER_TYPE@76..83 + 0: INFER_KW@76..82 "infer" [] [Whitespace(" ")] + 1: TS_TYPE_PARAMETER_NAME@82..83 + 0: IDENT@82..83 "U" [] [] + 2: (empty) + 4: (empty) + 2: R_CURLY@83..85 "}" [] [Whitespace(" ")] + 3: QUESTION@85..87 "?" [] [Whitespace(" ")] + 4: TS_REFERENCE_TYPE@87..89 + 0: JS_REFERENCE_IDENTIFIER@87..89 + 0: IDENT@87..89 "U" [] [Whitespace(" ")] + 1: (empty) + 5: COLON@89..91 ":" [] [Whitespace(" ")] + 6: TS_NEVER_TYPE@91..96 + 0: NEVER_KW@91..96 "never" [] [] + 5: SEMICOLON@96..97 ";" [] [] + 3: EOF@97..98 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts b/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts index aa133398f790..08bbe0a2b898 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts +++ b/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts @@ -1,2 +1,2 @@ -type A = infer B; -type B = { a: infer U; b: infer U}; +type A = A extends infer B ? B : never; +type B = A extends { a: infer U; b: infer U} ? U : never; diff --git a/website/src/content/docs/internals/changelog.mdx b/website/src/content/docs/internals/changelog.mdx index fac951f783b3..9972c0cf5d03 100644 --- a/website/src/content/docs/internals/changelog.mdx +++ b/website/src/content/docs/internals/changelog.mdx @@ -38,6 +38,9 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom - Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4 ### Parser + +- Enhance diagnostic for infer type handling in the parser. The 'infer' keyword can only be utilized within the 'extends' clause of a conditional type. Using it outside of this context will result in an error. Ensure that any type declarations using 'infer' are correctly placed within the conditional type structure to avoid parsing issues. Contributed by @denbezrukov + ### VSCode ## 1.2.2 (2023-09-16)