From 4f38aa88c2eb917b92d0d4081f2752a3212e66f5 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 27 Apr 2019 16:22:11 -0700 Subject: [PATCH] Add regression test --- .../substitutionTypesInIndexedAccessTypes.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/cases/compiler/substitutionTypesInIndexedAccessTypes.ts diff --git a/tests/cases/compiler/substitutionTypesInIndexedAccessTypes.ts b/tests/cases/compiler/substitutionTypesInIndexedAccessTypes.ts new file mode 100644 index 0000000000000..4a89ea3759533 --- /dev/null +++ b/tests/cases/compiler/substitutionTypesInIndexedAccessTypes.ts @@ -0,0 +1,20 @@ +// @strict: true + +// Repro from #31086 + +type UserArgs = { + select?: boolean +}; + +type Subset = { [key in keyof T]: key extends keyof U ? T[key] : never }; + +declare function withBoundary(args?: Subset): T; +declare function withoutBoundary(args?: T): T; + +const boundaryResult = withBoundary({ + select: true, +}); + +const withoutBoundaryResult = withoutBoundary({ + select: true, +});