TypeScript/tests/cases/compiler/nongenericPartialInstantiationsRelatedInBothDirections.ts
Wesley Wigham 13c08ab32b
Use identity with the permissive instantation to detect nongenric instances and disable variance probing on nongeneric instances (#29981)
* Use identity with the restrictive instantation to detect nongenric instances and disable variance probing on nongeneric instances

* Generalize to also include interfaces, add test case, still perform argument comparisons for postive comparisons if possible

* Actually accept baselines, lol

* Reduce deep nesting limit just a bit so yargs still builds

* Handle circular identities in isNonGeneric

* Use a simple traversal of the types rather than the restrictive instantiation

* Cache the bits using an existing field to further reduce any time nongeneric check takes

* Revert to using an existing mapper, use permissive > restrictive

* Revert constant change

* And revert the comment, too
2019-02-27 14:12:30 -08:00

13 lines
284 B
TypeScript

interface Foo {
a: number;
b: number;
bar: string;
}
interface ObjectContaining<T> {
new (sample: Partial<T>): Partial<T>
}
declare let cafoo: ObjectContaining<{ a: number, foo: number }>;
declare let cfoo: ObjectContaining<Foo>;
cfoo = cafoo;
cafoo = cfoo;