85c9d2cc89
* 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
42 lines
789 B
Plaintext
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
|
|
}
|