Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js_parser): Allow const in TsMethodSignatureTypeMember and TsCallSignatureTypeMember #1625

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: update test snapshots
magic-akari committed Jan 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f5836f722834869a7aed6a1e368c875fa78c3e41
Original file line number Diff line number Diff line change
@@ -181,15 +181,80 @@ JsModule {
},
semicolon_token: missing (optional),
},
TsTypeAliasDeclaration {
type_token: [email protected] "type" [Newline("\n")] [Whitespace(" ")],
binding_identifier: TsIdentifierBinding {
name_token: [email protected] "D" [] [Whitespace(" ")],
},
type_parameters: missing (optional),
eq_token: [email protected] "=" [] [Whitespace(" ")],
ty: TsObjectType {
l_curly_token: [email protected] "{" [] [Whitespace(" ")],
members: TsTypeMemberList [
TsCallSignatureTypeMember {
type_parameters: TsTypeParameters {
l_angle_token: [email protected] "<" [] [],
items: TsTypeParameterList [
TsTypeParameter {
modifiers: TsTypeParameterModifierList [
TsConstModifier {
modifier_token: [email protected] "const" [] [Whitespace(" ")],
},
],
name: TsTypeParameterName {
ident_token: [email protected] "A" [] [],
},
constraint: missing (optional),
default: missing (optional),
},
],
r_angle_token: [email protected] ">" [] [],
},
parameters: JsParameters {
l_paren_token: [email protected] "(" [] [],
items: JsParameterList [
JsFormalParameter {
decorators: JsDecoratorList [],
binding: JsIdentifierBinding {
name_token: [email protected] "a" [] [],
},
question_mark_token: missing (optional),
type_annotation: TsTypeAnnotation {
colon_token: [email protected] ":" [] [Whitespace(" ")],
ty: TsReferenceType {
name: JsReferenceIdentifier {
value_token: [email protected] "A" [] [],
},
type_arguments: missing (optional),
},
},
initializer: missing (optional),
},
],
r_paren_token: [email protected] ")" [] [],
},
return_type_annotation: TsReturnTypeAnnotation {
colon_token: [email protected] ":" [] [Whitespace(" ")],
ty: TsNumberType {
number_token: [email protected] "number" [] [Whitespace(" ")],
},
},
separator_token: missing (optional),
},
],
r_curly_token: [email protected] "}" [] [],
},
semicolon_token: missing (optional),
},
],
eof_token: EOF@95..96 "" [Newline("\n")] [],
eof_token: EOF@132..133 "" [Newline("\n")] [],
}

0: JS_MODULE@0..96
0: JS_MODULE@0..133
0: (empty)
1: (empty)
2: [email protected]
3: JS_MODULE_ITEM_LIST@0..95
3: JS_MODULE_ITEM_LIST@0..132
0: [email protected]
0: [email protected] "type" [] [Whitespace(" ")]
1: [email protected]
@@ -320,4 +385,49 @@ JsModule {
3: (empty)
2: [email protected] "}" [] []
5: (empty)
4: [email protected] "" [Newline("\n")] []
3: [email protected]
0: [email protected] "type" [Newline("\n")] [Whitespace(" ")]
1: [email protected]
0: [email protected] "D" [] [Whitespace(" ")]
2: (empty)
3: [email protected] "=" [] [Whitespace(" ")]
4: [email protected]
0: [email protected] "{" [] [Whitespace(" ")]
1: [email protected]
0: [email protected]
0: [email protected]
0: [email protected] "<" [] []
1: [email protected]
0: [email protected]
0: [email protected]
0: [email protected]
0: [email protected] "const" [] [Whitespace(" ")]
1: [email protected]
0: [email protected] "A" [] []
2: (empty)
3: (empty)
2: [email protected] ">" [] []
1: [email protected]
0: [email protected] "(" [] []
1: [email protected]
0: [email protected]
0: [email protected]
1: [email protected]
0: [email protected] "a" [] []
2: (empty)
3: [email protected]
0: [email protected] ":" [] [Whitespace(" ")]
1: [email protected]
0: [email protected]
0: [email protected] "A" [] []
1: (empty)
4: (empty)
2: [email protected] ")" [] []
2: [email protected]
0: [email protected] ":" [] [Whitespace(" ")]
1: [email protected]
0: [email protected] "number" [] [Whitespace(" ")]
3: (empty)
2: [email protected] "}" [] []
5: (empty)
4: [email protected] "" [Newline("\n")] []
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
type A = { (): string; }
type B = { (a, b, c): number }
type C = { <A, B>(a: A, b: B): number }
type D = { <const A>(a: A): number }
Original file line number Diff line number Diff line change
@@ -313,15 +313,84 @@ JsModule {
},
semicolon_token: missing (optional),
},
TsTypeAliasDeclaration {
type_token: [email protected] "type" [Newline("\n")] [Whitespace(" ")],
binding_identifier: TsIdentifierBinding {
name_token: [email protected] "F" [] [Whitespace(" ")],
},
type_parameters: missing (optional),
eq_token: [email protected] "=" [] [Whitespace(" ")],
ty: TsObjectType {
l_curly_token: [email protected] "{" [] [Whitespace(" ")],
members: TsTypeMemberList [
TsMethodSignatureTypeMember {
name: JsLiteralMemberName {
value: [email protected] "m" [] [],
},
optional_token: missing (optional),
type_parameters: TsTypeParameters {
l_angle_token: [email protected] "<" [] [],
items: TsTypeParameterList [
TsTypeParameter {
modifiers: TsTypeParameterModifierList [
TsConstModifier {
modifier_token: [email protected] "const" [] [Whitespace(" ")],
},
],
name: TsTypeParameterName {
ident_token: [email protected] "A" [] [],
},
constraint: missing (optional),
default: missing (optional),
},
],
r_angle_token: [email protected] ">" [] [],
},
parameters: JsParameters {
l_paren_token: [email protected] "(" [] [],
items: JsParameterList [
JsFormalParameter {
decorators: JsDecoratorList [],
binding: JsIdentifierBinding {
name_token: [email protected] "a" [] [],
},
question_mark_token: missing (optional),
type_annotation: TsTypeAnnotation {
colon_token: [email protected] ":" [] [Whitespace(" ")],
ty: TsReferenceType {
name: JsReferenceIdentifier {
value_token: [email protected] "A" [] [],
},
type_arguments: missing (optional),
},
},
initializer: missing (optional),
},
],
r_paren_token: [email protected] ")" [] [],
},
return_type_annotation: TsReturnTypeAnnotation {
colon_token: [email protected] ":" [] [Whitespace(" ")],
ty: TsNeverType {
never_token: [email protected] "never" [] [Whitespace(" ")],
},
},
separator_token: missing (optional),
},
],
r_curly_token: [email protected] "}" [] [],
},
semicolon_token: missing (optional),
},
],
eof_token: EOF@216..217 "" [Newline("\n")] [],
eof_token: EOF@253..254 "" [Newline("\n")] [],
}

0: JS_MODULE@0..217
0: JS_MODULE@0..254
0: (empty)
1: (empty)
2: [email protected]
3: JS_MODULE_ITEM_LIST@0..216
3: JS_MODULE_ITEM_LIST@0..253
0: [email protected]
0: [email protected] "type" [] [Whitespace(" ")]
1: [email protected]
@@ -546,4 +615,52 @@ JsModule {
5: (empty)
2: [email protected] "}" [] []
5: (empty)
4: [email protected] "" [Newline("\n")] []
5: [email protected]
0: [email protected] "type" [Newline("\n")] [Whitespace(" ")]
1: [email protected]
0: [email protected] "F" [] [Whitespace(" ")]
2: (empty)
3: [email protected] "=" [] [Whitespace(" ")]
4: [email protected]
0: [email protected] "{" [] [Whitespace(" ")]
1: [email protected]
0: [email protected]
0: [email protected]
0: [email protected] "m" [] []
1: (empty)
2: [email protected]
0: [email protected] "<" [] []
1: [email protected]
0: [email protected]
0: [email protected]
0: [email protected]
0: [email protected] "const" [] [Whitespace(" ")]
1: [email protected]
0: [email protected] "A" [] []
2: (empty)
3: (empty)
2: [email protected] ">" [] []
3: [email protected]
0: [email protected] "(" [] []
1: [email protected]
0: [email protected]
0: [email protected]
1: [email protected]
0: [email protected] "a" [] []
2: (empty)
3: [email protected]
0: [email protected] ":" [] [Whitespace(" ")]
1: [email protected]
0: [email protected]
0: [email protected] "A" [] []
1: (empty)
4: (empty)
2: [email protected] ")" [] []
4: [email protected]
0: [email protected] ":" [] [Whitespace(" ")]
1: [email protected]
0: [email protected] "never" [] [Whitespace(" ")]
5: (empty)
2: [email protected] "}" [] []
5: (empty)
4: [email protected] "" [Newline("\n")] []
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ type B = { a: string, b(): number }
type C = { m(a: string, b: number, c: string): any }
type D = { readonly: string, readonly a: number }
type E = { m<A, B>(a: A, b: B): never }
type F = { m<const A>(a: A): never }