mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
34 lines
711 B
TypeScript
34 lines
711 B
TypeScript
//// [tests/cases/compiler/classSideInheritance1.ts] ////
|
|
|
|
//// [classSideInheritance1.ts]
|
|
class A {
|
|
static bar(): string {
|
|
return "";
|
|
}
|
|
foo(): number { return 1; }
|
|
}
|
|
|
|
class C2 extends A {}
|
|
|
|
declare var a: A;
|
|
declare var c: C2;
|
|
a.bar(); // static off an instance - should be an error
|
|
c.bar(); // static off an instance - should be an error
|
|
A.bar(); // valid
|
|
C2.bar(); // valid
|
|
|
|
//// [classSideInheritance1.js]
|
|
"use strict";
|
|
class A {
|
|
static bar() {
|
|
return "";
|
|
}
|
|
foo() { return 1; }
|
|
}
|
|
class C2 extends A {
|
|
}
|
|
a.bar(); // static off an instance - should be an error
|
|
c.bar(); // static off an instance - should be an error
|
|
A.bar(); // valid
|
|
C2.bar(); // valid
|