|
| 1 | +=== tests/cases/compiler/localTypeParameterInferencePriority.ts === |
| 2 | +export type UnrollOnHover<O extends object> = O extends object ? |
| 3 | +>UnrollOnHover : Symbol(UnrollOnHover, Decl(localTypeParameterInferencePriority.ts, 0, 0)) |
| 4 | +>O : Symbol(O, Decl(localTypeParameterInferencePriority.ts, 0, 26)) |
| 5 | +>O : Symbol(O, Decl(localTypeParameterInferencePriority.ts, 0, 26)) |
| 6 | + |
| 7 | + { [K in keyof O]: O[K]; } : |
| 8 | +>K : Symbol(K, Decl(localTypeParameterInferencePriority.ts, 1, 7)) |
| 9 | +>O : Symbol(O, Decl(localTypeParameterInferencePriority.ts, 0, 26)) |
| 10 | +>O : Symbol(O, Decl(localTypeParameterInferencePriority.ts, 0, 26)) |
| 11 | +>K : Symbol(K, Decl(localTypeParameterInferencePriority.ts, 1, 7)) |
| 12 | + |
| 13 | + never; |
| 14 | + |
| 15 | + |
| 16 | +export type Schema = Record<string, unknown>; |
| 17 | +>Schema : Symbol(Schema, Decl(localTypeParameterInferencePriority.ts, 2, 10)) |
| 18 | +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) |
| 19 | + |
| 20 | +class Table<S extends Schema> { |
| 21 | +>Table : Symbol(Table, Decl(localTypeParameterInferencePriority.ts, 5, 45)) |
| 22 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 6, 12)) |
| 23 | +>Schema : Symbol(Schema, Decl(localTypeParameterInferencePriority.ts, 2, 10)) |
| 24 | + |
| 25 | + __schema!: S; |
| 26 | +>__schema : Symbol(Table.__schema, Decl(localTypeParameterInferencePriority.ts, 6, 32)) |
| 27 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 6, 12)) |
| 28 | + |
| 29 | + // Removing this line, removes the error |
| 30 | + getRows<C extends keyof S>(): Array<UnrollOnHover<Pick<S, C>>> { |
| 31 | +>getRows : Symbol(Table.getRows, Decl(localTypeParameterInferencePriority.ts, 7, 17)) |
| 32 | +>C : Symbol(C, Decl(localTypeParameterInferencePriority.ts, 10, 12)) |
| 33 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 6, 12)) |
| 34 | +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) |
| 35 | +>UnrollOnHover : Symbol(UnrollOnHover, Decl(localTypeParameterInferencePriority.ts, 0, 0)) |
| 36 | +>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) |
| 37 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 6, 12)) |
| 38 | +>C : Symbol(C, Decl(localTypeParameterInferencePriority.ts, 10, 12)) |
| 39 | + |
| 40 | + return null! |
| 41 | + } |
| 42 | +} |
| 43 | + |
| 44 | +class ColumnSelectViewImp<S extends Schema> extends Table<S> { } |
| 45 | +>ColumnSelectViewImp : Symbol(ColumnSelectViewImp, Decl(localTypeParameterInferencePriority.ts, 13, 1)) |
| 46 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 15, 26)) |
| 47 | +>Schema : Symbol(Schema, Decl(localTypeParameterInferencePriority.ts, 2, 10)) |
| 48 | +>Table : Symbol(Table, Decl(localTypeParameterInferencePriority.ts, 5, 45)) |
| 49 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 15, 26)) |
| 50 | + |
| 51 | + |
| 52 | +const ColumnSelectView1: new <S extends Schema>() => Table<UnrollOnHover<S>> = ColumnSelectViewImp; |
| 53 | +>ColumnSelectView1 : Symbol(ColumnSelectView1, Decl(localTypeParameterInferencePriority.ts, 18, 5)) |
| 54 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 18, 30)) |
| 55 | +>Schema : Symbol(Schema, Decl(localTypeParameterInferencePriority.ts, 2, 10)) |
| 56 | +>Table : Symbol(Table, Decl(localTypeParameterInferencePriority.ts, 5, 45)) |
| 57 | +>UnrollOnHover : Symbol(UnrollOnHover, Decl(localTypeParameterInferencePriority.ts, 0, 0)) |
| 58 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 18, 30)) |
| 59 | +>ColumnSelectViewImp : Symbol(ColumnSelectViewImp, Decl(localTypeParameterInferencePriority.ts, 13, 1)) |
| 60 | + |
| 61 | +const ColumnSelectView2: new <S extends Schema>() => Table<UnrollOnHover<S>> = Table; |
| 62 | +>ColumnSelectView2 : Symbol(ColumnSelectView2, Decl(localTypeParameterInferencePriority.ts, 19, 5)) |
| 63 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 19, 30)) |
| 64 | +>Schema : Symbol(Schema, Decl(localTypeParameterInferencePriority.ts, 2, 10)) |
| 65 | +>Table : Symbol(Table, Decl(localTypeParameterInferencePriority.ts, 5, 45)) |
| 66 | +>UnrollOnHover : Symbol(UnrollOnHover, Decl(localTypeParameterInferencePriority.ts, 0, 0)) |
| 67 | +>S : Symbol(S, Decl(localTypeParameterInferencePriority.ts, 19, 30)) |
| 68 | +>Table : Symbol(Table, Decl(localTypeParameterInferencePriority.ts, 5, 45)) |
| 69 | + |
0 commit comments