2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/overloadingOnConstants1.ts(22,5): error TS2322: Type 'Base' is not assignable to type 'Derived1'.
|
2014-09-12 22:35:07 +02:00
|
|
|
Property 'bar' is missing in type 'Base'.
|
2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/overloadingOnConstants1.ts(23,5): error TS2322: Type 'Derived1' is not assignable to type 'Derived3'.
|
2014-09-12 22:35:07 +02:00
|
|
|
Property 'biz' is missing in type 'Derived1'.
|
2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/overloadingOnConstants1.ts(24,5): error TS2322: Type 'Derived2' is not assignable to type 'Derived1'.
|
2014-09-12 22:35:07 +02:00
|
|
|
Property 'bar' is missing in type 'Derived2'.
|
2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/overloadingOnConstants1.ts(25,5): error TS2322: Type 'Derived3' is not assignable to type 'Derived1'.
|
2014-09-12 22:35:07 +02:00
|
|
|
Property 'bar' is missing in type 'Derived3'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/overloadingOnConstants1.ts (4 errors) ====
|
|
|
|
class Base { foo() { } }
|
|
|
|
class Derived1 extends Base { bar() { } }
|
|
|
|
class Derived2 extends Base { baz() { } }
|
|
|
|
class Derived3 extends Base { biz() { } }
|
|
|
|
|
|
|
|
interface Document2 {
|
|
|
|
createElement(tagName: 'canvas'): Derived1;
|
|
|
|
createElement(tagName: 'div'): Derived2;
|
|
|
|
createElement(tagName: 'span'): Derived3;
|
|
|
|
createElement(tagName: string): Base;
|
|
|
|
}
|
|
|
|
|
|
|
|
var d2: Document2;
|
|
|
|
|
|
|
|
// these are ok
|
|
|
|
var htmlElement: Base = d2.createElement("yo")
|
|
|
|
var htmlCanvasElement: Derived1 = d2.createElement("canvas");
|
|
|
|
var htmlDivElement: Derived2 = d2.createElement("div");
|
|
|
|
var htmlSpanElement: Derived3 = d2.createElement("span");
|
|
|
|
|
|
|
|
// these are errors
|
|
|
|
var htmlElement2: Derived1 = d2.createElement("yo")
|
2014-07-19 02:30:06 +02:00
|
|
|
~~~~~~~~~~~~
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Type 'Base' is not assignable to type 'Derived1'.
|
|
|
|
!!! error TS2322: Property 'bar' is missing in type 'Base'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var htmlCanvasElement2: Derived3 = d2.createElement("canvas");
|
2014-07-19 02:30:06 +02:00
|
|
|
~~~~~~~~~~~~~~~~~~
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Type 'Derived1' is not assignable to type 'Derived3'.
|
|
|
|
!!! error TS2322: Property 'biz' is missing in type 'Derived1'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var htmlDivElement2: Derived1 = d2.createElement("div");
|
2014-07-19 02:30:06 +02:00
|
|
|
~~~~~~~~~~~~~~~
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Type 'Derived2' is not assignable to type 'Derived1'.
|
|
|
|
!!! error TS2322: Property 'bar' is missing in type 'Derived2'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var htmlSpanElement2: Derived1 = d2.createElement("span");
|
2014-07-19 02:30:06 +02:00
|
|
|
~~~~~~~~~~~~~~~~
|
2014-11-05 21:26:03 +01:00
|
|
|
!!! error TS2322: Type 'Derived3' is not assignable to type 'Derived1'.
|
|
|
|
!!! error TS2322: Property 'bar' is missing in type 'Derived3'.
|