|
| 1 | +=== tests/cases/compiler/invariantGenericErrorElaboration.ts === |
| 2 | +// Repro from #19746 |
| 3 | + |
| 4 | +const wat: Runtype<any> = Num; |
| 5 | +>wat : Symbol(wat, Decl(invariantGenericErrorElaboration.ts, 2, 5)) |
| 6 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 7 | +>Num : Symbol(Num, Decl(invariantGenericErrorElaboration.ts, 8, 1), Decl(invariantGenericErrorElaboration.ts, 13, 13)) |
| 8 | + |
| 9 | +const Foo = Obj({ foo: Num }) |
| 10 | +>Foo : Symbol(Foo, Decl(invariantGenericErrorElaboration.ts, 3, 5)) |
| 11 | +>Obj : Symbol(Obj, Decl(invariantGenericErrorElaboration.ts, 13, 22), Decl(invariantGenericErrorElaboration.ts, 15, 111)) |
| 12 | +>foo : Symbol(foo, Decl(invariantGenericErrorElaboration.ts, 3, 17)) |
| 13 | +>Num : Symbol(Num, Decl(invariantGenericErrorElaboration.ts, 8, 1), Decl(invariantGenericErrorElaboration.ts, 13, 13)) |
| 14 | + |
| 15 | +interface Runtype<A> { |
| 16 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 17 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 5, 18)) |
| 18 | + |
| 19 | + constraint: Constraint<this> |
| 20 | +>constraint : Symbol(Runtype.constraint, Decl(invariantGenericErrorElaboration.ts, 5, 22)) |
| 21 | +>Constraint : Symbol(Constraint, Decl(invariantGenericErrorElaboration.ts, 16, 81)) |
| 22 | + |
| 23 | + witness: A |
| 24 | +>witness : Symbol(Runtype.witness, Decl(invariantGenericErrorElaboration.ts, 6, 30)) |
| 25 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 5, 18)) |
| 26 | +} |
| 27 | + |
| 28 | +interface Num extends Runtype<number> { |
| 29 | +>Num : Symbol(Num, Decl(invariantGenericErrorElaboration.ts, 8, 1), Decl(invariantGenericErrorElaboration.ts, 13, 13)) |
| 30 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 31 | + |
| 32 | + tag: 'number' |
| 33 | +>tag : Symbol(Num.tag, Decl(invariantGenericErrorElaboration.ts, 10, 39)) |
| 34 | +} |
| 35 | +declare const Num: Num |
| 36 | +>Num : Symbol(Num, Decl(invariantGenericErrorElaboration.ts, 8, 1), Decl(invariantGenericErrorElaboration.ts, 13, 13)) |
| 37 | +>Num : Symbol(Num, Decl(invariantGenericErrorElaboration.ts, 8, 1), Decl(invariantGenericErrorElaboration.ts, 13, 13)) |
| 38 | + |
| 39 | +interface Obj<O extends { [_ in string]: Runtype<any> }> extends Runtype<{[K in keyof O]: O[K]['witness'] }> {} |
| 40 | +>Obj : Symbol(Obj, Decl(invariantGenericErrorElaboration.ts, 13, 22), Decl(invariantGenericErrorElaboration.ts, 15, 111)) |
| 41 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 15, 14)) |
| 42 | +>_ : Symbol(_, Decl(invariantGenericErrorElaboration.ts, 15, 27)) |
| 43 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 44 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 45 | +>K : Symbol(K, Decl(invariantGenericErrorElaboration.ts, 15, 75)) |
| 46 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 15, 14)) |
| 47 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 15, 14)) |
| 48 | +>K : Symbol(K, Decl(invariantGenericErrorElaboration.ts, 15, 75)) |
| 49 | + |
| 50 | +declare function Obj<O extends { [_: string]: Runtype<any> }>(fields: O): Obj<O>; |
| 51 | +>Obj : Symbol(Obj, Decl(invariantGenericErrorElaboration.ts, 13, 22), Decl(invariantGenericErrorElaboration.ts, 15, 111)) |
| 52 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 16, 21)) |
| 53 | +>_ : Symbol(_, Decl(invariantGenericErrorElaboration.ts, 16, 34)) |
| 54 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 55 | +>fields : Symbol(fields, Decl(invariantGenericErrorElaboration.ts, 16, 62)) |
| 56 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 16, 21)) |
| 57 | +>Obj : Symbol(Obj, Decl(invariantGenericErrorElaboration.ts, 13, 22), Decl(invariantGenericErrorElaboration.ts, 15, 111)) |
| 58 | +>O : Symbol(O, Decl(invariantGenericErrorElaboration.ts, 16, 21)) |
| 59 | + |
| 60 | +interface Constraint<A extends Runtype<any>> extends Runtype<A['witness']> { |
| 61 | +>Constraint : Symbol(Constraint, Decl(invariantGenericErrorElaboration.ts, 16, 81)) |
| 62 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 18, 21)) |
| 63 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 64 | +>Runtype : Symbol(Runtype, Decl(invariantGenericErrorElaboration.ts, 3, 29)) |
| 65 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 18, 21)) |
| 66 | + |
| 67 | + underlying: A, |
| 68 | +>underlying : Symbol(Constraint.underlying, Decl(invariantGenericErrorElaboration.ts, 18, 76)) |
| 69 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 18, 21)) |
| 70 | + |
| 71 | + check: (x: A['witness']) => void, |
| 72 | +>check : Symbol(Constraint.check, Decl(invariantGenericErrorElaboration.ts, 19, 16)) |
| 73 | +>x : Symbol(x, Decl(invariantGenericErrorElaboration.ts, 20, 10)) |
| 74 | +>A : Symbol(A, Decl(invariantGenericErrorElaboration.ts, 18, 21)) |
| 75 | +} |
| 76 | + |
0 commit comments