TypeScript/tests/baselines/reference/typeParameterExtendingUnion2.types
Wesley Wigham 85c9d2cc89
Use faster, stricter prop type comparison when merging props in union prop creation (#43696)
* Use faster, stricter prop type comparison when merging props in union prop creation

* Be better at determining this usage in methods, accept baselines

* Small style change
2021-04-19 15:25:12 -07:00

42 lines
789 B
Plaintext

=== tests/cases/compiler/typeParameterExtendingUnion2.ts ===
class Animal { run() { } }
>Animal : Animal
>run : () => void
class Cat extends Animal { meow }
>Cat : Cat
>Animal : Animal
>meow : any
class Dog extends Animal { woof }
>Dog : Dog
>Animal : Animal
>woof : any
function run(a: Cat | Dog) {
>run : (a: Cat | Dog) => void
>a : Cat | Dog
a.run();
>a.run() : void
>a.run : (() => void) | (() => void)
>a : Cat | Dog
>run : (() => void) | (() => void)
}
function f<T extends Cat | Dog>(a: T) {
>f : <T extends Cat | Dog>(a: T) => void
>a : T
a.run();
>a.run() : void
>a.run : (() => void) | (() => void)
>a : Cat | Dog
>run : (() => void) | (() => void)
run(a);
>run(a) : void
>run : (a: Cat | Dog) => void
>a : Cat | Dog
}