Skip to content

Commit 2aac25c

Browse files
committed
Add failing test for nested infer
1 parent c6e880a commit 2aac25c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/js_parser/ts_parser_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ func TestTSTypes(t *testing.T) {
180180
expectPrintedTS(t, "type Foo = Bar extends [infer T] ? T : null", "")
181181
expectPrintedTS(t, "type Foo = Bar extends [infer T extends string] ? T : null", "")
182182
expectPrintedTS(t, "let x: A extends B<infer C extends D> ? D : never", "let x;\n")
183+
expectPrintedTS(t, `type Normalized<T> = T extends Array<infer A extends object ? infer A : never>
184+
? Dictionary<Normalized<A>>
185+
: {
186+
[P in keyof T]: T[P] extends Array<infer A extends object ? infer A : never>
187+
? Dictionary<Normalized<A>>
188+
: Normalized<T[P]>
189+
}`, "")
183190

184191
expectPrintedTS(t, "let x: A.B<X.Y>", "let x;\n")
185192
expectPrintedTS(t, "let x: A.B<X.Y>=2", "let x = 2;\n")

0 commit comments

Comments
 (0)