373accf28f
* Decrease recursion depth limit to 3 + smarter check for recursion * Accept new baselines * Always set last type id * Keep indexed access recursion depth check * Less expensive and corrected check for broadest equivalent keys
39 lines
1.8 KiB
Plaintext
39 lines
1.8 KiB
Plaintext
tests/cases/compiler/invariantGenericErrorElaboration.ts(3,7): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
|
|
The types of 'constraint.constraint' are incompatible between these types.
|
|
Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'.
|
|
Type 'Runtype<any>' is not assignable to type 'Num'.
|
|
tests/cases/compiler/invariantGenericErrorElaboration.ts(4,19): error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
|
|
|
|
|
|
==== tests/cases/compiler/invariantGenericErrorElaboration.ts (2 errors) ====
|
|
// Repro from #19746
|
|
|
|
const wat: Runtype<any> = Num;
|
|
~~~
|
|
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
|
|
!!! error TS2322: The types of 'constraint.constraint' are incompatible between these types.
|
|
!!! error TS2322: Type 'Constraint<Constraint<Num>>' is not assignable to type 'Constraint<Constraint<Runtype<any>>>'.
|
|
!!! error TS2322: Type 'Runtype<any>' is not assignable to type 'Num'.
|
|
const Foo = Obj({ foo: Num })
|
|
~~~
|
|
!!! error TS2322: Type 'Num' is not assignable to type 'Runtype<any>'.
|
|
!!! related TS6501 tests/cases/compiler/invariantGenericErrorElaboration.ts:17:34: The expected type comes from this index signature.
|
|
|
|
interface Runtype<A> {
|
|
constraint: Constraint<this>
|
|
witness: A
|
|
}
|
|
|
|
interface Num extends Runtype<number> {
|
|
tag: 'number'
|
|
}
|
|
declare const Num: Num
|
|
|
|
interface Obj<O extends { [_ in string]: Runtype<any> }> extends Runtype<{[K in keyof O]: O[K]['witness'] }> {}
|
|
declare function Obj<O extends { [_: string]: Runtype<any> }>(fields: O): Obj<O>;
|
|
|
|
interface Constraint<A extends Runtype<any>> extends Runtype<A['witness']> {
|
|
underlying: A,
|
|
check: (x: A['witness']) => void,
|
|
}
|
|
|