18 lines
332 B
TypeScript
18 lines
332 B
TypeScript
|
class Base {
|
||
|
n: Base | string;
|
||
|
fn() {
|
||
|
return 10;
|
||
|
}
|
||
|
}
|
||
|
class Derived extends Base {
|
||
|
n: Derived | string;
|
||
|
fn() {
|
||
|
return 10 as number | string;
|
||
|
}
|
||
|
}
|
||
|
class DerivedInterface implements Base {
|
||
|
n: DerivedInterface | string;
|
||
|
fn() {
|
||
|
return 10 as number | string;
|
||
|
}
|
||
|
}
|