Conflicts: tests/baselines/reference/APISample_compile.types tests/baselines/reference/APISample_linter.types tests/baselines/reference/APISample_transform.types tests/baselines/reference/APISample_watcher.types
47 lines
748 B
Plaintext
47 lines
748 B
Plaintext
=== tests/cases/compiler/typeParameterExtendingUnion1.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: Animal) {
|
|
>run : (a: Animal) => void
|
|
>a : Animal
|
|
>Animal : Animal
|
|
|
|
a.run();
|
|
>a.run() : void
|
|
>a.run : () => void
|
|
>a : Animal
|
|
>run : () => void
|
|
}
|
|
|
|
function f<T extends Cat | Dog>(a: T) {
|
|
>f : <T extends Cat | Dog>(a: T) => void
|
|
>T : T
|
|
>Cat : Cat
|
|
>Dog : Dog
|
|
>a : T
|
|
>T : T
|
|
|
|
a.run();
|
|
>a.run() : void
|
|
>a.run : () => void
|
|
>a : T
|
|
>run : () => void
|
|
|
|
run(a);
|
|
>run(a) : void
|
|
>run : (a: Animal) => void
|
|
>a : T
|
|
}
|