TypeScript/tests/cases/compiler/unwitnessedTypeParameterVariance.ts
Anders Hejlsberg 58a05f3e87
Normalize type references before relating them (#35266)
* Normalize type references before relating them in isRelatedTo

* Add comments

* Accept new baselines

* Add regression tests

* Accept new baselines

* Use aliases when available in error reporting

* Accept new baselines
2019-11-22 15:40:18 -08:00

26 lines
412 B
TypeScript

// @strict: true
// Repros from #33872
export interface CalcObj<O> {
read: (origin: O) => CalcValue<O>;
}
export type CalcValue<O> = CalcObj<O>;
function foo<O>() {
const unk: CalcObj<unknown> = { read: (origin: unknown) => unk }
const x: CalcObj<O> = unk;
}
type A<T> = B<T>;
interface B<T> {
prop: A<T>;
}
declare let a: A<number>;
declare let b: A<3>;
b = a;