TS2636
Type 'Func
' is not assignable to type 'Func ' as implied by variance annotation. Type 'super-T' is not assignable to type 'sub-T'.
Broken Code ❌
type Func<in T> = () => T;Fixed Code ✔️
Variance annotations on type variables must be consistent with their position. If a type variable is at output (read) position, it should be annotated with out:
type Func<out T> = () => T;Alternatively, you can annotate it with both in and out (i.e. as invariant):
type Func<in out T> = () => T;