mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Merge branch 'master' into stringLiteralTypes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
error TS1204: Cannot compile modules into 'es6' when targeting 'ES5' or lower.
|
||||
error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
|
||||
|
||||
!!! error TS1204: Cannot compile modules into 'es6' when targeting 'ES5' or lower.
|
||||
!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
==== tests/cases/compiler/es5andes6module.ts (0 errors) ====
|
||||
|
||||
export default class A
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
error TS5047: Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
|
||||
error TS5047: Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.
|
||||
|
||||
|
||||
!!! error TS5047: Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
|
||||
!!! error TS5047: Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher.
|
||||
==== tests/cases/compiler/isolatedModulesUnspecifiedModule.ts (0 errors) ====
|
||||
export var x;
|
||||
96
tests/baselines/reference/mergedInheritedClassInterface.js
Normal file
96
tests/baselines/reference/mergedInheritedClassInterface.js
Normal file
@@ -0,0 +1,96 @@
|
||||
//// [mergedInheritedClassInterface.ts]
|
||||
interface BaseInterface {
|
||||
required: number;
|
||||
optional?: number;
|
||||
}
|
||||
|
||||
class BaseClass {
|
||||
baseMethod() { }
|
||||
baseNumber: number;
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
additional: number;
|
||||
}
|
||||
|
||||
class Child extends BaseClass {
|
||||
classNumber: number;
|
||||
method() { }
|
||||
}
|
||||
|
||||
interface ChildNoBaseClass extends BaseInterface {
|
||||
additional2: string;
|
||||
}
|
||||
class ChildNoBaseClass {
|
||||
classString: string;
|
||||
method2() { }
|
||||
}
|
||||
class Grandchild extends ChildNoBaseClass {
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.additional;
|
||||
child.baseNumber;
|
||||
child.classNumber;
|
||||
child.baseMethod();
|
||||
child.method();
|
||||
|
||||
var grandchild: Grandchild;
|
||||
grandchild.required;
|
||||
grandchild.optional;
|
||||
grandchild.additional2;
|
||||
grandchild.classString;
|
||||
grandchild.method2();
|
||||
|
||||
|
||||
//// [mergedInheritedClassInterface.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var BaseClass = (function () {
|
||||
function BaseClass() {
|
||||
}
|
||||
BaseClass.prototype.baseMethod = function () { };
|
||||
return BaseClass;
|
||||
})();
|
||||
var Child = (function (_super) {
|
||||
__extends(Child, _super);
|
||||
function Child() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
Child.prototype.method = function () { };
|
||||
return Child;
|
||||
})(BaseClass);
|
||||
var ChildNoBaseClass = (function () {
|
||||
function ChildNoBaseClass() {
|
||||
}
|
||||
ChildNoBaseClass.prototype.method2 = function () { };
|
||||
return ChildNoBaseClass;
|
||||
})();
|
||||
var Grandchild = (function (_super) {
|
||||
__extends(Grandchild, _super);
|
||||
function Grandchild() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return Grandchild;
|
||||
})(ChildNoBaseClass);
|
||||
// checks if properties actually were merged
|
||||
var child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.additional;
|
||||
child.baseNumber;
|
||||
child.classNumber;
|
||||
child.baseMethod();
|
||||
child.method();
|
||||
var grandchild;
|
||||
grandchild.required;
|
||||
grandchild.optional;
|
||||
grandchild.additional2;
|
||||
grandchild.classString;
|
||||
grandchild.method2();
|
||||
130
tests/baselines/reference/mergedInheritedClassInterface.symbols
Normal file
130
tests/baselines/reference/mergedInheritedClassInterface.symbols
Normal file
@@ -0,0 +1,130 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/mergedInheritedClassInterface.ts ===
|
||||
interface BaseInterface {
|
||||
>BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0))
|
||||
|
||||
required: number;
|
||||
>required : Symbol(required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
|
||||
optional?: number;
|
||||
>optional : Symbol(optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
}
|
||||
|
||||
class BaseClass {
|
||||
>BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1))
|
||||
|
||||
baseMethod() { }
|
||||
>baseMethod : Symbol(baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 17))
|
||||
|
||||
baseNumber: number;
|
||||
>baseNumber : Symbol(baseNumber, Decl(mergedInheritedClassInterface.ts, 6, 20))
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
>BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0))
|
||||
|
||||
additional: number;
|
||||
>additional : Symbol(additional, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
}
|
||||
|
||||
class Child extends BaseClass {
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
>BaseClass : Symbol(BaseClass, Decl(mergedInheritedClassInterface.ts, 3, 1))
|
||||
|
||||
classNumber: number;
|
||||
>classNumber : Symbol(classNumber, Decl(mergedInheritedClassInterface.ts, 14, 31))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(method, Decl(mergedInheritedClassInterface.ts, 15, 24))
|
||||
}
|
||||
|
||||
interface ChildNoBaseClass extends BaseInterface {
|
||||
>ChildNoBaseClass : Symbol(ChildNoBaseClass, Decl(mergedInheritedClassInterface.ts, 17, 1), Decl(mergedInheritedClassInterface.ts, 21, 1))
|
||||
>BaseInterface : Symbol(BaseInterface, Decl(mergedInheritedClassInterface.ts, 0, 0))
|
||||
|
||||
additional2: string;
|
||||
>additional2 : Symbol(additional2, Decl(mergedInheritedClassInterface.ts, 19, 50))
|
||||
}
|
||||
class ChildNoBaseClass {
|
||||
>ChildNoBaseClass : Symbol(ChildNoBaseClass, Decl(mergedInheritedClassInterface.ts, 17, 1), Decl(mergedInheritedClassInterface.ts, 21, 1))
|
||||
|
||||
classString: string;
|
||||
>classString : Symbol(classString, Decl(mergedInheritedClassInterface.ts, 22, 24))
|
||||
|
||||
method2() { }
|
||||
>method2 : Symbol(method2, Decl(mergedInheritedClassInterface.ts, 23, 24))
|
||||
}
|
||||
class Grandchild extends ChildNoBaseClass {
|
||||
>Grandchild : Symbol(Grandchild, Decl(mergedInheritedClassInterface.ts, 25, 1))
|
||||
>ChildNoBaseClass : Symbol(ChildNoBaseClass, Decl(mergedInheritedClassInterface.ts, 17, 1), Decl(mergedInheritedClassInterface.ts, 21, 1))
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>Child : Symbol(Child, Decl(mergedInheritedClassInterface.ts, 8, 1), Decl(mergedInheritedClassInterface.ts, 12, 1))
|
||||
|
||||
child.required;
|
||||
>child.required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
|
||||
child.optional;
|
||||
>child.optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
|
||||
child.additional;
|
||||
>child.additional : Symbol(Child.additional, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>additional : Symbol(Child.additional, Decl(mergedInheritedClassInterface.ts, 10, 39))
|
||||
|
||||
child.baseNumber;
|
||||
>child.baseNumber : Symbol(BaseClass.baseNumber, Decl(mergedInheritedClassInterface.ts, 6, 20))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>baseNumber : Symbol(BaseClass.baseNumber, Decl(mergedInheritedClassInterface.ts, 6, 20))
|
||||
|
||||
child.classNumber;
|
||||
>child.classNumber : Symbol(Child.classNumber, Decl(mergedInheritedClassInterface.ts, 14, 31))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>classNumber : Symbol(Child.classNumber, Decl(mergedInheritedClassInterface.ts, 14, 31))
|
||||
|
||||
child.baseMethod();
|
||||
>child.baseMethod : Symbol(BaseClass.baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 17))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>baseMethod : Symbol(BaseClass.baseMethod, Decl(mergedInheritedClassInterface.ts, 5, 17))
|
||||
|
||||
child.method();
|
||||
>child.method : Symbol(Child.method, Decl(mergedInheritedClassInterface.ts, 15, 24))
|
||||
>child : Symbol(child, Decl(mergedInheritedClassInterface.ts, 30, 3))
|
||||
>method : Symbol(Child.method, Decl(mergedInheritedClassInterface.ts, 15, 24))
|
||||
|
||||
var grandchild: Grandchild;
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>Grandchild : Symbol(Grandchild, Decl(mergedInheritedClassInterface.ts, 25, 1))
|
||||
|
||||
grandchild.required;
|
||||
>grandchild.required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>required : Symbol(BaseInterface.required, Decl(mergedInheritedClassInterface.ts, 0, 25))
|
||||
|
||||
grandchild.optional;
|
||||
>grandchild.optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>optional : Symbol(BaseInterface.optional, Decl(mergedInheritedClassInterface.ts, 1, 21))
|
||||
|
||||
grandchild.additional2;
|
||||
>grandchild.additional2 : Symbol(ChildNoBaseClass.additional2, Decl(mergedInheritedClassInterface.ts, 19, 50))
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>additional2 : Symbol(ChildNoBaseClass.additional2, Decl(mergedInheritedClassInterface.ts, 19, 50))
|
||||
|
||||
grandchild.classString;
|
||||
>grandchild.classString : Symbol(ChildNoBaseClass.classString, Decl(mergedInheritedClassInterface.ts, 22, 24))
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>classString : Symbol(ChildNoBaseClass.classString, Decl(mergedInheritedClassInterface.ts, 22, 24))
|
||||
|
||||
grandchild.method2();
|
||||
>grandchild.method2 : Symbol(ChildNoBaseClass.method2, Decl(mergedInheritedClassInterface.ts, 23, 24))
|
||||
>grandchild : Symbol(grandchild, Decl(mergedInheritedClassInterface.ts, 39, 3))
|
||||
>method2 : Symbol(ChildNoBaseClass.method2, Decl(mergedInheritedClassInterface.ts, 23, 24))
|
||||
|
||||
133
tests/baselines/reference/mergedInheritedClassInterface.types
Normal file
133
tests/baselines/reference/mergedInheritedClassInterface.types
Normal file
@@ -0,0 +1,133 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/mergedInheritedClassInterface.ts ===
|
||||
interface BaseInterface {
|
||||
>BaseInterface : BaseInterface
|
||||
|
||||
required: number;
|
||||
>required : number
|
||||
|
||||
optional?: number;
|
||||
>optional : number
|
||||
}
|
||||
|
||||
class BaseClass {
|
||||
>BaseClass : BaseClass
|
||||
|
||||
baseMethod() { }
|
||||
>baseMethod : () => void
|
||||
|
||||
baseNumber: number;
|
||||
>baseNumber : number
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
>Child : Child
|
||||
>BaseInterface : BaseInterface
|
||||
|
||||
additional: number;
|
||||
>additional : number
|
||||
}
|
||||
|
||||
class Child extends BaseClass {
|
||||
>Child : Child
|
||||
>BaseClass : BaseClass
|
||||
|
||||
classNumber: number;
|
||||
>classNumber : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
|
||||
interface ChildNoBaseClass extends BaseInterface {
|
||||
>ChildNoBaseClass : ChildNoBaseClass
|
||||
>BaseInterface : BaseInterface
|
||||
|
||||
additional2: string;
|
||||
>additional2 : string
|
||||
}
|
||||
class ChildNoBaseClass {
|
||||
>ChildNoBaseClass : ChildNoBaseClass
|
||||
|
||||
classString: string;
|
||||
>classString : string
|
||||
|
||||
method2() { }
|
||||
>method2 : () => void
|
||||
}
|
||||
class Grandchild extends ChildNoBaseClass {
|
||||
>Grandchild : Grandchild
|
||||
>ChildNoBaseClass : ChildNoBaseClass
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
>child : Child
|
||||
>Child : Child
|
||||
|
||||
child.required;
|
||||
>child.required : number
|
||||
>child : Child
|
||||
>required : number
|
||||
|
||||
child.optional;
|
||||
>child.optional : number
|
||||
>child : Child
|
||||
>optional : number
|
||||
|
||||
child.additional;
|
||||
>child.additional : number
|
||||
>child : Child
|
||||
>additional : number
|
||||
|
||||
child.baseNumber;
|
||||
>child.baseNumber : number
|
||||
>child : Child
|
||||
>baseNumber : number
|
||||
|
||||
child.classNumber;
|
||||
>child.classNumber : number
|
||||
>child : Child
|
||||
>classNumber : number
|
||||
|
||||
child.baseMethod();
|
||||
>child.baseMethod() : void
|
||||
>child.baseMethod : () => void
|
||||
>child : Child
|
||||
>baseMethod : () => void
|
||||
|
||||
child.method();
|
||||
>child.method() : void
|
||||
>child.method : () => void
|
||||
>child : Child
|
||||
>method : () => void
|
||||
|
||||
var grandchild: Grandchild;
|
||||
>grandchild : Grandchild
|
||||
>Grandchild : Grandchild
|
||||
|
||||
grandchild.required;
|
||||
>grandchild.required : number
|
||||
>grandchild : Grandchild
|
||||
>required : number
|
||||
|
||||
grandchild.optional;
|
||||
>grandchild.optional : number
|
||||
>grandchild : Grandchild
|
||||
>optional : number
|
||||
|
||||
grandchild.additional2;
|
||||
>grandchild.additional2 : string
|
||||
>grandchild : Grandchild
|
||||
>additional2 : string
|
||||
|
||||
grandchild.classString;
|
||||
>grandchild.classString : string
|
||||
>grandchild : Grandchild
|
||||
>classString : string
|
||||
|
||||
grandchild.method2();
|
||||
>grandchild.method2() : void
|
||||
>grandchild.method2 : () => void
|
||||
>grandchild : Grandchild
|
||||
>method2 : () => void
|
||||
|
||||
@@ -8,7 +8,7 @@ System.register([], function(exports_1) {
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
x = 1;
|
||||
exports_1("x", x = 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{}'.
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (1 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2
|
||||
|
||||
f({}, 10, 10);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{}'.
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
f `abcdef${ 1234 }${ 5678 }ghijkl`;
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{}'.
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts (1 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error T
|
||||
|
||||
f({}, 10, 10);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{}'.
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
|
||||
f `abcdef${ 1234 }${ 5678 }ghijkl`;
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/typeAliasDeclareKeyword01.d.ts ===
|
||||
type Foo = number;
|
||||
>Foo : Symbol(Foo, Decl(typeAliasDeclareKeyword01.d.ts, 0, 0))
|
||||
|
||||
declare type Bar = string;
|
||||
>Bar : Symbol(Bar, Decl(typeAliasDeclareKeyword01.d.ts, 0, 18))
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/typeAliasDeclareKeyword01.d.ts ===
|
||||
type Foo = number;
|
||||
>Foo : number
|
||||
|
||||
declare type Bar = string;
|
||||
>Bar : string
|
||||
|
||||
@@ -28,9 +28,10 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(67,12): error TS2
|
||||
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(68,12): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,12): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/union/unionTypeCallSignatures.ts(73,12): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (30 errors) ====
|
||||
==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (31 errors) ====
|
||||
var numOrDate: number | Date;
|
||||
var strOrBoolean: string | boolean;
|
||||
var strOrNum: string | number;
|
||||
@@ -162,4 +163,9 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };
|
||||
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
@@ -70,6 +70,9 @@ strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature
|
||||
strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature
|
||||
strOrNum = unionWithRestParameter3(); // error no call signature
|
||||
|
||||
var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };
|
||||
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
|
||||
//// [unionTypeCallSignatures.js]
|
||||
@@ -132,3 +135,6 @@ strOrNum = unionWithRestParameter3('hello', 10); // error no call signature
|
||||
strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature
|
||||
strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature
|
||||
strOrNum = unionWithRestParameter3(); // error no call signature
|
||||
var unionWithRestParameter4;
|
||||
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
2
tests/cases/compiler/typeAliasDeclareKeyword01.d.ts
vendored
Normal file
2
tests/cases/compiler/typeAliasDeclareKeyword01.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
type Foo = number;
|
||||
declare type Bar = string;
|
||||
@@ -0,0 +1,45 @@
|
||||
interface BaseInterface {
|
||||
required: number;
|
||||
optional?: number;
|
||||
}
|
||||
|
||||
class BaseClass {
|
||||
baseMethod() { }
|
||||
baseNumber: number;
|
||||
}
|
||||
|
||||
interface Child extends BaseInterface {
|
||||
additional: number;
|
||||
}
|
||||
|
||||
class Child extends BaseClass {
|
||||
classNumber: number;
|
||||
method() { }
|
||||
}
|
||||
|
||||
interface ChildNoBaseClass extends BaseInterface {
|
||||
additional2: string;
|
||||
}
|
||||
class ChildNoBaseClass {
|
||||
classString: string;
|
||||
method2() { }
|
||||
}
|
||||
class Grandchild extends ChildNoBaseClass {
|
||||
}
|
||||
|
||||
// checks if properties actually were merged
|
||||
var child : Child;
|
||||
child.required;
|
||||
child.optional;
|
||||
child.additional;
|
||||
child.baseNumber;
|
||||
child.classNumber;
|
||||
child.baseMethod();
|
||||
child.method();
|
||||
|
||||
var grandchild: Grandchild;
|
||||
grandchild.required;
|
||||
grandchild.optional;
|
||||
grandchild.additional2;
|
||||
grandchild.classString;
|
||||
grandchild.method2();
|
||||
@@ -69,3 +69,6 @@ strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature
|
||||
strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature
|
||||
strOrNum = unionWithRestParameter3(); // error no call signature
|
||||
|
||||
var unionWithRestParameter4: { (...a: string[]): string; } | { (a: string, b: string): number; };
|
||||
strOrNum = unionWithRestParameter4("hello"); // error supplied parameters do not match any call signature
|
||||
strOrNum = unionWithRestParameter4("hello", "world");
|
||||
|
||||
Reference in New Issue
Block a user