Skip to content

Commit bd6912a

Browse files
committed
Add test for type_query precedence
1 parent 1b3ba31 commit bd6912a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

common/corpus/types.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,3 +1407,32 @@ type Foo<T> = abstract new () => T;
14071407
---
14081408

14091409
(program (type_alias_declaration (type_identifier) (type_parameters (type_parameter (type_identifier))) (constructor_type (formal_parameters) (type_identifier))))
1410+
1411+
=========================
1412+
Indexed Access Precedence
1413+
=========================
1414+
1415+
// These should generate the same AST aside from the parenthesized_type node
1416+
type X1 = typeof Y[keyof typeof Z];
1417+
type X2 = (typeof Y)[keyof typeof Z];
1418+
1419+
---
1420+
1421+
(program
1422+
(comment)
1423+
(type_alias_declaration
1424+
(type_identifier)
1425+
(type_query
1426+
(identifier))
1427+
(ERROR
1428+
(identifier)
1429+
(identifier)))
1430+
(type_alias_declaration
1431+
(type_identifier)
1432+
(lookup_type
1433+
(parenthesized_type
1434+
(type_query
1435+
(identifier)))
1436+
(index_type_query
1437+
(type_query
1438+
(identifier))))))

0 commit comments

Comments
 (0)