mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
40 lines
687 B
TypeScript
40 lines
687 B
TypeScript
//// [tests/cases/compiler/baseClassImprovedMismatchErrors.ts] ////
|
|
|
|
//// [baseClassImprovedMismatchErrors.ts]
|
|
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;
|
|
}
|
|
}
|
|
|
|
//// [baseClassImprovedMismatchErrors.js]
|
|
"use strict";
|
|
class Base {
|
|
fn() {
|
|
return 10;
|
|
}
|
|
}
|
|
class Derived extends Base {
|
|
fn() {
|
|
return 10;
|
|
}
|
|
}
|
|
class DerivedInterface {
|
|
fn() {
|
|
return 10;
|
|
}
|
|
}
|