|
| 1 | +=== tests/cases/compiler/substitutionTypesInIndexedAccessTypes.ts === |
| 2 | +// Repro from #31086 |
| 3 | + |
| 4 | +type UserArgs = { |
| 5 | +>UserArgs : Symbol(UserArgs, Decl(substitutionTypesInIndexedAccessTypes.ts, 0, 0)) |
| 6 | + |
| 7 | + select?: boolean |
| 8 | +>select : Symbol(select, Decl(substitutionTypesInIndexedAccessTypes.ts, 2, 17)) |
| 9 | + |
| 10 | +}; |
| 11 | + |
| 12 | +type Subset<T, U> = { [key in keyof T]: key extends keyof U ? T[key] : never }; |
| 13 | +>Subset : Symbol(Subset, Decl(substitutionTypesInIndexedAccessTypes.ts, 4, 2)) |
| 14 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 12)) |
| 15 | +>U : Symbol(U, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 14)) |
| 16 | +>key : Symbol(key, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 23)) |
| 17 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 12)) |
| 18 | +>key : Symbol(key, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 23)) |
| 19 | +>U : Symbol(U, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 14)) |
| 20 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 12)) |
| 21 | +>key : Symbol(key, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 23)) |
| 22 | + |
| 23 | +declare function withBoundary<T extends UserArgs>(args?: Subset<T, UserArgs>): T; |
| 24 | +>withBoundary : Symbol(withBoundary, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 79)) |
| 25 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 30)) |
| 26 | +>UserArgs : Symbol(UserArgs, Decl(substitutionTypesInIndexedAccessTypes.ts, 0, 0)) |
| 27 | +>args : Symbol(args, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 50)) |
| 28 | +>Subset : Symbol(Subset, Decl(substitutionTypesInIndexedAccessTypes.ts, 4, 2)) |
| 29 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 30)) |
| 30 | +>UserArgs : Symbol(UserArgs, Decl(substitutionTypesInIndexedAccessTypes.ts, 0, 0)) |
| 31 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 30)) |
| 32 | + |
| 33 | +declare function withoutBoundary<T extends UserArgs>(args?: T): T; |
| 34 | +>withoutBoundary : Symbol(withoutBoundary, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 81)) |
| 35 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 9, 33)) |
| 36 | +>UserArgs : Symbol(UserArgs, Decl(substitutionTypesInIndexedAccessTypes.ts, 0, 0)) |
| 37 | +>args : Symbol(args, Decl(substitutionTypesInIndexedAccessTypes.ts, 9, 53)) |
| 38 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 9, 33)) |
| 39 | +>T : Symbol(T, Decl(substitutionTypesInIndexedAccessTypes.ts, 9, 33)) |
| 40 | + |
| 41 | +const boundaryResult = withBoundary({ |
| 42 | +>boundaryResult : Symbol(boundaryResult, Decl(substitutionTypesInIndexedAccessTypes.ts, 11, 5)) |
| 43 | +>withBoundary : Symbol(withBoundary, Decl(substitutionTypesInIndexedAccessTypes.ts, 6, 79)) |
| 44 | + |
| 45 | + select: true, |
| 46 | +>select : Symbol(select, Decl(substitutionTypesInIndexedAccessTypes.ts, 11, 37)) |
| 47 | + |
| 48 | +}); |
| 49 | + |
| 50 | +const withoutBoundaryResult = withoutBoundary({ |
| 51 | +>withoutBoundaryResult : Symbol(withoutBoundaryResult, Decl(substitutionTypesInIndexedAccessTypes.ts, 15, 5)) |
| 52 | +>withoutBoundary : Symbol(withoutBoundary, Decl(substitutionTypesInIndexedAccessTypes.ts, 8, 81)) |
| 53 | + |
| 54 | + select: true, |
| 55 | +>select : Symbol(select, Decl(substitutionTypesInIndexedAccessTypes.ts, 15, 47)) |
| 56 | + |
| 57 | +}); |
| 58 | + |
0 commit comments