mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into cleanHarnessOptionLoading
Conflicts: src/harness/harness.ts
This commit is contained in:
@@ -4,7 +4,7 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes
|
||||
|
||||
|
||||
==== tests/cases/compiler/aliasAssignments_1.ts (2 errors) ====
|
||||
import moduleA = require("aliasAssignments_moduleA");
|
||||
import moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
~
|
||||
|
||||
@@ -6,7 +6,7 @@ export class someClass {
|
||||
}
|
||||
|
||||
//// [aliasAssignments_1.ts]
|
||||
import moduleA = require("aliasAssignments_moduleA");
|
||||
import moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
var y = 1;
|
||||
@@ -21,7 +21,7 @@ var someClass = (function () {
|
||||
})();
|
||||
exports.someClass = someClass;
|
||||
//// [aliasAssignments_1.js]
|
||||
var moduleA = require("aliasAssignments_moduleA");
|
||||
var moduleA = require("./aliasAssignments_moduleA");
|
||||
var x = moduleA;
|
||||
x = 1; // Should be error
|
||||
var y = 1;
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsage1_moduleA.ts]
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsage1_main.ts]
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsage1_backbone");
|
||||
var Backbone = require("./aliasUsage1_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -50,7 +50,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsage1_main.js]
|
||||
var moduleA = require("aliasUsage1_moduleA");
|
||||
var moduleA = require("./aliasUsage1_moduleA");
|
||||
var C2 = (function () {
|
||||
function C2() {
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsage1_main.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_main.ts, 2, 34))
|
||||
@@ -19,7 +19,7 @@ class C2 {
|
||||
|
||||
x: IHasVisualizationModel;
|
||||
>x : Symbol(x, Decl(aliasUsage1_main.ts, 5, 10))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 48))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsage1_main.ts, 1, 50))
|
||||
|
||||
get A() {
|
||||
>A : Symbol(A, Decl(aliasUsage1_main.ts, 6, 30), Decl(aliasUsage1_main.ts, 9, 5))
|
||||
@@ -35,7 +35,7 @@ class C2 {
|
||||
|
||||
x = moduleA;
|
||||
>x : Symbol(x, Decl(aliasUsage1_main.ts, 10, 10))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 50))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsage1_main.ts, 0, 52))
|
||||
}
|
||||
}
|
||||
=== tests/cases/compiler/aliasUsage1_backbone.ts ===
|
||||
@@ -47,11 +47,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 50))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsage1_moduleA.ts, 0, 52))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsage1_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsage1_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsage1_main.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsage1_moduleA");
|
||||
import moduleA = require("./aliasUsage1_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -48,7 +48,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsage1_moduleA.ts ===
|
||||
import Backbone = require("aliasUsage1_backbone");
|
||||
import Backbone = require("./aliasUsage1_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInArray_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInArray_main.ts]
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInArray_backbone");
|
||||
var Backbone = require("./aliasUsageInArray_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -44,6 +44,6 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInArray_main.js]
|
||||
var moduleA = require("aliasUsageInArray_moduleA");
|
||||
var moduleA = require("./aliasUsageInArray_moduleA");
|
||||
var xs = [moduleA];
|
||||
var xs2 = [moduleA];
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_main.ts, 0, 0))
|
||||
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
|
||||
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_main.ts, 2, 34))
|
||||
@@ -17,13 +17,13 @@ interface IHasVisualizationModel {
|
||||
|
||||
var xs: IHasVisualizationModel[] = [moduleA];
|
||||
>xs : Symbol(xs, Decl(aliasUsageInArray_main.ts, 6, 3))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 54))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>IHasVisualizationModel : Symbol(IHasVisualizationModel, Decl(aliasUsageInArray_main.ts, 1, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
var xs2: typeof moduleA[] = [moduleA];
|
||||
>xs2 : Symbol(xs2, Decl(aliasUsageInArray_main.ts, 7, 3))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 56))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
>moduleA : Symbol(moduleA, Decl(aliasUsageInArray_main.ts, 0, 58))
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_backbone.ts ===
|
||||
export class Model {
|
||||
@@ -34,11 +34,11 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 56))
|
||||
>VisualizationModel : Symbol(VisualizationModel, Decl(aliasUsageInArray_moduleA.ts, 0, 58))
|
||||
>Backbone.Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
|
||||
>Backbone : Symbol(Backbone, Decl(aliasUsageInArray_moduleA.ts, 0, 0))
|
||||
>Model : Symbol(Backbone.Model, Decl(aliasUsageInArray_backbone.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/aliasUsageInArray_main.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
import moduleA = require("aliasUsageInArray_moduleA");
|
||||
import moduleA = require("./aliasUsageInArray_moduleA");
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
interface IHasVisualizationModel {
|
||||
@@ -36,7 +36,7 @@ export class Model {
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/aliasUsageInArray_moduleA.ts ===
|
||||
import Backbone = require("aliasUsageInArray_backbone");
|
||||
import Backbone = require("./aliasUsageInArray_backbone");
|
||||
>Backbone : typeof Backbone
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
|
||||
@@ -6,14 +6,14 @@ export class Model {
|
||||
}
|
||||
|
||||
//// [aliasUsageInFunctionExpression_moduleA.ts]
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
// interesting stuff here
|
||||
}
|
||||
|
||||
//// [aliasUsageInFunctionExpression_main.ts]
|
||||
import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
import moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
import Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
import moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
interface IHasVisualizationModel {
|
||||
VisualizationModel: typeof Backbone.Model;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
var Backbone = require("./aliasUsageInFunctionExpression_backbone");
|
||||
var VisualizationModel = (function (_super) {
|
||||
__extends(VisualizationModel, _super);
|
||||
function VisualizationModel() {
|
||||
@@ -43,6 +43,6 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInFunctionExpression_main.js]
|
||||
var moduleA = require("aliasUsageInFunctionExpression_moduleA");
|
||||
var moduleA = require("./aliasUsageInFunctionExpression_moduleA");
|
||||
var f = function (x) { return x; };
|
||||
f = function (x) { return moduleA; };
|
||||
|
||||
@@ -294,8 +294,8 @@ module EmptyTypes {
|
||||
|
||||
// Order matters here so test all the variants
|
||||
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
|
||||
>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[]
|
||||
>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[]
|
||||
>a1 : { x: any; y: string; }[]
|
||||
>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: 0, y: 'a' } : { x: number; y: string; }
|
||||
>x : number
|
||||
>0 : number
|
||||
@@ -313,8 +313,8 @@ module EmptyTypes {
|
||||
>'a' : string
|
||||
|
||||
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
|
||||
>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[]
|
||||
>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[]
|
||||
>a2 : { x: any; y: string; }[]
|
||||
>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: anyObj, y: 'a' } : { x: any; y: string; }
|
||||
>x : any
|
||||
>anyObj : any
|
||||
@@ -332,8 +332,8 @@ module EmptyTypes {
|
||||
>'a' : string
|
||||
|
||||
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
|
||||
>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[]
|
||||
>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[]
|
||||
>a3 : { x: any; y: string; }[]
|
||||
>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: 0, y: 'a' } : { x: number; y: string; }
|
||||
>x : number
|
||||
>0 : number
|
||||
@@ -639,7 +639,7 @@ module NonEmptyTypes {
|
||||
>x : number
|
||||
>y : base
|
||||
>base : base
|
||||
>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : ({ x: number; y: derived; } | { x: number; y: base; })[]
|
||||
>[{ x: 7, y: new derived() }, { x: 5, y: new base() }] : { x: number; y: base; }[]
|
||||
>{ x: 7, y: new derived() } : { x: number; y: derived; }
|
||||
>x : number
|
||||
>7 : number
|
||||
@@ -658,7 +658,7 @@ module NonEmptyTypes {
|
||||
>x : boolean
|
||||
>y : base
|
||||
>base : base
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : ({ x: boolean; y: derived; } | { x: boolean; y: base; })[]
|
||||
>[{ x: true, y: new derived() }, { x: false, y: new base() }] : { x: boolean; y: base; }[]
|
||||
>{ x: true, y: new derived() } : { x: boolean; y: derived; }
|
||||
>x : boolean
|
||||
>true : boolean
|
||||
@@ -697,8 +697,8 @@ module NonEmptyTypes {
|
||||
|
||||
// Order matters here so test all the variants
|
||||
var a1 = [{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }];
|
||||
>a1 : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[]
|
||||
>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : ({ x: number; y: string; } | { x: string; y: string; } | { x: any; y: string; })[]
|
||||
>a1 : { x: any; y: string; }[]
|
||||
>[{ x: 0, y: 'a' }, { x: 'a', y: 'a' }, { x: anyObj, y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: 0, y: 'a' } : { x: number; y: string; }
|
||||
>x : number
|
||||
>0 : number
|
||||
@@ -716,8 +716,8 @@ module NonEmptyTypes {
|
||||
>'a' : string
|
||||
|
||||
var a2 = [{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }];
|
||||
>a2 : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[]
|
||||
>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: any; y: string; } | { x: number; y: string; } | { x: string; y: string; })[]
|
||||
>a2 : { x: any; y: string; }[]
|
||||
>[{ x: anyObj, y: 'a' }, { x: 0, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: anyObj, y: 'a' } : { x: any; y: string; }
|
||||
>x : any
|
||||
>anyObj : any
|
||||
@@ -735,8 +735,8 @@ module NonEmptyTypes {
|
||||
>'a' : string
|
||||
|
||||
var a3 = [{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }];
|
||||
>a3 : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[]
|
||||
>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : ({ x: number; y: string; } | { x: any; y: string; } | { x: string; y: string; })[]
|
||||
>a3 : { x: any; y: string; }[]
|
||||
>[{ x: 0, y: 'a' }, { x: anyObj, y: 'a' }, { x: 'a', y: 'a' }] : { x: any; y: string; }[]
|
||||
>{ x: 0, y: 'a' } : { x: number; y: string; }
|
||||
>x : number
|
||||
>0 : number
|
||||
@@ -769,29 +769,29 @@ module NonEmptyTypes {
|
||||
>base2 : typeof base2
|
||||
|
||||
var b1 = [baseObj, base2Obj, ifaceObj];
|
||||
>b1 : (base | base2 | iface)[]
|
||||
>[baseObj, base2Obj, ifaceObj] : (base | base2 | iface)[]
|
||||
>b1 : iface[]
|
||||
>[baseObj, base2Obj, ifaceObj] : iface[]
|
||||
>baseObj : base
|
||||
>base2Obj : base2
|
||||
>ifaceObj : iface
|
||||
|
||||
var b2 = [base2Obj, baseObj, ifaceObj];
|
||||
>b2 : (base2 | base | iface)[]
|
||||
>[base2Obj, baseObj, ifaceObj] : (base2 | base | iface)[]
|
||||
>b2 : iface[]
|
||||
>[base2Obj, baseObj, ifaceObj] : iface[]
|
||||
>base2Obj : base2
|
||||
>baseObj : base
|
||||
>ifaceObj : iface
|
||||
|
||||
var b3 = [baseObj, ifaceObj, base2Obj];
|
||||
>b3 : (base | iface | base2)[]
|
||||
>[baseObj, ifaceObj, base2Obj] : (base | iface | base2)[]
|
||||
>b3 : iface[]
|
||||
>[baseObj, ifaceObj, base2Obj] : iface[]
|
||||
>baseObj : base
|
||||
>ifaceObj : iface
|
||||
>base2Obj : base2
|
||||
|
||||
var b4 = [ifaceObj, baseObj, base2Obj];
|
||||
>b4 : (iface | base | base2)[]
|
||||
>[ifaceObj, baseObj, base2Obj] : (iface | base | base2)[]
|
||||
>b4 : iface[]
|
||||
>[ifaceObj, baseObj, base2Obj] : iface[]
|
||||
>ifaceObj : iface
|
||||
>baseObj : base
|
||||
>base2Obj : base2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other.
|
||||
tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other.
|
||||
Type '{ foo: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: strin
|
||||
// Should fail. Even though the array is contextually typed with { id: number }[], it still
|
||||
// has type { foo: string }[], which is not assignable to { id: number }[].
|
||||
<{ id: number; }[]>[{ foo: "s" }];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other.
|
||||
!!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2352: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/arrayLiteralTypeInference.ts(13,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'.
|
||||
tests/cases/compiler/arrayLiteralTypeInference.ts(14,14): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'.
|
||||
Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'.
|
||||
Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'.
|
||||
Object literal may only specify known properties, and 'trueness' does not exist in type 'Action'.
|
||||
tests/cases/compiler/arrayLiteralTypeInference.ts(29,5): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
tests/cases/compiler/arrayLiteralTypeInference.ts(31,18): error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'trueness' does not exist in type '{ id: number; }'.
|
||||
@@ -22,12 +22,12 @@ tests/cases/compiler/arrayLiteralTypeInference.ts(29,5): error TS2322: Type '({
|
||||
}
|
||||
|
||||
var x1: Action[] = [
|
||||
~~
|
||||
{ id: 2, trueness: false },
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type 'Action[]'.
|
||||
!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type 'Action'.
|
||||
!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type 'Action'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'trueness' does not exist in type 'Action'.
|
||||
{ id: 2, trueness: false },
|
||||
{ id: 3, name: "three" }
|
||||
]
|
||||
|
||||
@@ -43,13 +43,13 @@ tests/cases/compiler/arrayLiteralTypeInference.ts(29,5): error TS2322: Type '({
|
||||
]
|
||||
|
||||
var z1: { id: number }[] =
|
||||
~~
|
||||
[
|
||||
{ id: 2, trueness: false },
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '({ id: number; trueness: boolean; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type '{ id: number; trueness: boolean; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type '{ id: number; trueness: boolean; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'trueness' does not exist in type '{ id: number; }'.
|
||||
[
|
||||
{ id: 2, trueness: false },
|
||||
{ id: 3, name: "three" }
|
||||
]
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ var cs = [a, b, c]; // { x: number; y?: number };[]
|
||||
>c : { x: number; a?: number; }
|
||||
|
||||
var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
|
||||
>ds : (((x: Object) => number) | ((x: string) => number))[]
|
||||
>[(x: Object) => 1, (x: string) => 2] : (((x: Object) => number) | ((x: string) => number))[]
|
||||
>ds : ((x: Object) => number)[]
|
||||
>[(x: Object) => 1, (x: string) => 2] : ((x: Object) => number)[]
|
||||
>(x: Object) => 1 : (x: Object) => number
|
||||
>x : Object
|
||||
>Object : Object
|
||||
@@ -47,8 +47,8 @@ var ds = [(x: Object) => 1, (x: string) => 2]; // { (x:Object) => number }[]
|
||||
>2 : number
|
||||
|
||||
var es = [(x: string) => 2, (x: Object) => 1]; // { (x:string) => number }[]
|
||||
>es : (((x: string) => number) | ((x: Object) => number))[]
|
||||
>[(x: string) => 2, (x: Object) => 1] : (((x: string) => number) | ((x: Object) => number))[]
|
||||
>es : ((x: string) => number)[]
|
||||
>[(x: string) => 2, (x: Object) => 1] : ((x: string) => number)[]
|
||||
>(x: string) => 2 : (x: string) => number
|
||||
>x : string
|
||||
>2 : number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts(24,5): error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts(24,77): error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'.
|
||||
Index signatures are incompatible.
|
||||
Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'.
|
||||
Type '{ a: string; b: number; c: string; }' is not assignable to type '{ a: string; b: number; }'.
|
||||
@@ -30,7 +30,7 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts(24,5): error
|
||||
|
||||
// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[]
|
||||
var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }];
|
||||
~~~~~~~~
|
||||
~~~~~
|
||||
!!! error TS2322: Type '({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[]' is not assignable to type '{ [n: number]: { a: string; b: number; }; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type '{ a: string; b: number; c: string; } | { a: string; b: number; c: number; }' is not assignable to type '{ a: string; b: number; }'.
|
||||
|
||||
@@ -77,8 +77,8 @@ var myDerivedList: DerivedList<number>;
|
||||
>DerivedList : DerivedList<U>
|
||||
|
||||
var as = [list, myDerivedList]; // List<number>[]
|
||||
>as : (List<number> | DerivedList<number>)[]
|
||||
>[list, myDerivedList] : (List<number> | DerivedList<number>)[]
|
||||
>as : List<number>[]
|
||||
>[list, myDerivedList] : List<number>[]
|
||||
>list : List<number>
|
||||
>myDerivedList : DerivedList<number>
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(17,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts(26,10): error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts (2 errors) ====
|
||||
// valid uses of arrays of function types
|
||||
|
||||
var x = [() => 1, () => { }];
|
||||
var r2 = x[0]();
|
||||
|
||||
class C {
|
||||
foo: string;
|
||||
}
|
||||
var y = [C, C];
|
||||
var r3 = new y[0]();
|
||||
|
||||
var a: { (x: number): number; (x: string): string; };
|
||||
var b: { (x: number): number; (x: string): string; };
|
||||
var c: { (x: number): number; (x: any): any; };
|
||||
var z = [a, b, c];
|
||||
var r4 = z[0];
|
||||
var r5 = r4(''); // any not string
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
var r5b = r4(1);
|
||||
|
||||
var a2: { <T>(x: T): number; (x: string): string;};
|
||||
var b2: { <T>(x: T): number; (x: string): string; };
|
||||
var c2: { (x: number): number; <T>(x: T): any; };
|
||||
|
||||
var z2 = [a2, b2, c2];
|
||||
var r6 = z2[0];
|
||||
var r7 = r6(''); // any not string
|
||||
~~~~~~
|
||||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature.
|
||||
@@ -0,0 +1,93 @@
|
||||
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts ===
|
||||
// valid uses of arrays of function types
|
||||
|
||||
var x = [() => 1, () => { }];
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3))
|
||||
|
||||
var r2 = x[0]();
|
||||
>r2 : Symbol(r2, Decl(arrayOfFunctionTypes3.ts, 3, 3))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 2, 3))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16))
|
||||
|
||||
foo: string;
|
||||
>foo : Symbol(foo, Decl(arrayOfFunctionTypes3.ts, 5, 9))
|
||||
}
|
||||
var y = [C, C];
|
||||
>y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3))
|
||||
>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16))
|
||||
>C : Symbol(C, Decl(arrayOfFunctionTypes3.ts, 3, 16))
|
||||
|
||||
var r3 = new y[0]();
|
||||
>r3 : Symbol(r3, Decl(arrayOfFunctionTypes3.ts, 9, 3))
|
||||
>y : Symbol(y, Decl(arrayOfFunctionTypes3.ts, 8, 3))
|
||||
|
||||
var a: { (x: number): number; (x: string): string; };
|
||||
>a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 10))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 11, 31))
|
||||
|
||||
var b: { (x: number): number; (x: string): string; };
|
||||
>b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 10))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 12, 31))
|
||||
|
||||
var c: { (x: number): number; (x: any): any; };
|
||||
>c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 10))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 13, 31))
|
||||
|
||||
var z = [a, b, c];
|
||||
>z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3))
|
||||
>a : Symbol(a, Decl(arrayOfFunctionTypes3.ts, 11, 3))
|
||||
>b : Symbol(b, Decl(arrayOfFunctionTypes3.ts, 12, 3))
|
||||
>c : Symbol(c, Decl(arrayOfFunctionTypes3.ts, 13, 3))
|
||||
|
||||
var r4 = z[0];
|
||||
>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3))
|
||||
>z : Symbol(z, Decl(arrayOfFunctionTypes3.ts, 14, 3))
|
||||
|
||||
var r5 = r4(''); // any not string
|
||||
>r5 : Symbol(r5, Decl(arrayOfFunctionTypes3.ts, 16, 3))
|
||||
>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3))
|
||||
|
||||
var r5b = r4(1);
|
||||
>r5b : Symbol(r5b, Decl(arrayOfFunctionTypes3.ts, 17, 3))
|
||||
>r4 : Symbol(r4, Decl(arrayOfFunctionTypes3.ts, 15, 3))
|
||||
|
||||
var a2: { <T>(x: T): number; (x: string): string;};
|
||||
>a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 14))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 19, 11))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 19, 30))
|
||||
|
||||
var b2: { <T>(x: T): number; (x: string): string; };
|
||||
>b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 14))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 20, 11))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 20, 30))
|
||||
|
||||
var c2: { (x: number): number; <T>(x: T): any; };
|
||||
>c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 11))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32))
|
||||
>x : Symbol(x, Decl(arrayOfFunctionTypes3.ts, 21, 35))
|
||||
>T : Symbol(T, Decl(arrayOfFunctionTypes3.ts, 21, 32))
|
||||
|
||||
var z2 = [a2, b2, c2];
|
||||
>z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3))
|
||||
>a2 : Symbol(a2, Decl(arrayOfFunctionTypes3.ts, 19, 3))
|
||||
>b2 : Symbol(b2, Decl(arrayOfFunctionTypes3.ts, 20, 3))
|
||||
>c2 : Symbol(c2, Decl(arrayOfFunctionTypes3.ts, 21, 3))
|
||||
|
||||
var r6 = z2[0];
|
||||
>r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3))
|
||||
>z2 : Symbol(z2, Decl(arrayOfFunctionTypes3.ts, 23, 3))
|
||||
|
||||
var r7 = r6(''); // any not string
|
||||
>r7 : Symbol(r7, Decl(arrayOfFunctionTypes3.ts, 25, 3))
|
||||
>r6 : Symbol(r6, Decl(arrayOfFunctionTypes3.ts, 24, 3))
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayOfFunctionTypes3.ts ===
|
||||
// valid uses of arrays of function types
|
||||
|
||||
var x = [() => 1, () => { }];
|
||||
>x : (() => void)[]
|
||||
>[() => 1, () => { }] : (() => void)[]
|
||||
>() => 1 : () => number
|
||||
>1 : number
|
||||
>() => { } : () => void
|
||||
|
||||
var r2 = x[0]();
|
||||
>r2 : void
|
||||
>x[0]() : void
|
||||
>x[0] : () => void
|
||||
>x : (() => void)[]
|
||||
>0 : number
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
foo: string;
|
||||
>foo : string
|
||||
}
|
||||
var y = [C, C];
|
||||
>y : typeof C[]
|
||||
>[C, C] : typeof C[]
|
||||
>C : typeof C
|
||||
>C : typeof C
|
||||
|
||||
var r3 = new y[0]();
|
||||
>r3 : C
|
||||
>new y[0]() : C
|
||||
>y[0] : typeof C
|
||||
>y : typeof C[]
|
||||
>0 : number
|
||||
|
||||
var a: { (x: number): number; (x: string): string; };
|
||||
>a : { (x: number): number; (x: string): string; }
|
||||
>x : number
|
||||
>x : string
|
||||
|
||||
var b: { (x: number): number; (x: string): string; };
|
||||
>b : { (x: number): number; (x: string): string; }
|
||||
>x : number
|
||||
>x : string
|
||||
|
||||
var c: { (x: number): number; (x: any): any; };
|
||||
>c : { (x: number): number; (x: any): any; }
|
||||
>x : number
|
||||
>x : any
|
||||
|
||||
var z = [a, b, c];
|
||||
>z : { (x: number): number; (x: any): any; }[]
|
||||
>[a, b, c] : { (x: number): number; (x: any): any; }[]
|
||||
>a : { (x: number): number; (x: string): string; }
|
||||
>b : { (x: number): number; (x: string): string; }
|
||||
>c : { (x: number): number; (x: any): any; }
|
||||
|
||||
var r4 = z[0];
|
||||
>r4 : { (x: number): number; (x: any): any; }
|
||||
>z[0] : { (x: number): number; (x: any): any; }
|
||||
>z : { (x: number): number; (x: any): any; }[]
|
||||
>0 : number
|
||||
|
||||
var r5 = r4(''); // any not string
|
||||
>r5 : any
|
||||
>r4('') : any
|
||||
>r4 : { (x: number): number; (x: any): any; }
|
||||
>'' : string
|
||||
|
||||
var r5b = r4(1);
|
||||
>r5b : number
|
||||
>r4(1) : number
|
||||
>r4 : { (x: number): number; (x: any): any; }
|
||||
>1 : number
|
||||
|
||||
var a2: { <T>(x: T): number; (x: string): string;};
|
||||
>a2 : { <T>(x: T): number; (x: string): string; }
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>x : string
|
||||
|
||||
var b2: { <T>(x: T): number; (x: string): string; };
|
||||
>b2 : { <T>(x: T): number; (x: string): string; }
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>x : string
|
||||
|
||||
var c2: { (x: number): number; <T>(x: T): any; };
|
||||
>c2 : { (x: number): number; <T>(x: T): any; }
|
||||
>x : number
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
var z2 = [a2, b2, c2];
|
||||
>z2 : { (x: number): number; <T>(x: T): any; }[]
|
||||
>[a2, b2, c2] : { (x: number): number; <T>(x: T): any; }[]
|
||||
>a2 : { <T>(x: T): number; (x: string): string; }
|
||||
>b2 : { <T>(x: T): number; (x: string): string; }
|
||||
>c2 : { (x: number): number; <T>(x: T): any; }
|
||||
|
||||
var r6 = z2[0];
|
||||
>r6 : { (x: number): number; <T>(x: T): any; }
|
||||
>z2[0] : { (x: number): number; <T>(x: T): any; }
|
||||
>z2 : { (x: number): number; <T>(x: T): any; }[]
|
||||
>0 : number
|
||||
|
||||
var r7 = r6(''); // any not string
|
||||
>r7 : any
|
||||
>r6('') : any
|
||||
>r6 : { (x: number): number; <T>(x: T): any; }
|
||||
>'' : string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(1,27): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(3,8): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(5,1): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(5,13): error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
|
||||
Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'.
|
||||
@@ -14,17 +14,17 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n:
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatBug2.ts (6 errors) ====
|
||||
var b2: { b: number;} = { a: 0 }; // error
|
||||
~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
|
||||
b2 = { a: 0 }; // error
|
||||
~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
|
||||
b2 = {b: 0, a: 0 };
|
||||
~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ b: number; a: number; }' is not assignable to type '{ b: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ b: number; }'.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug5.ts(2,8): error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ
|
||||
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
|
||||
function foo1(x: { a: number; }) { }
|
||||
foo1({ b: 5 });
|
||||
~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ var r = true ? 1 : 2;
|
||||
>2 : number
|
||||
|
||||
var r3 = true ? 1 : {};
|
||||
>r3 : number | {}
|
||||
>true ? 1 : {} : number | {}
|
||||
>r3 : {}
|
||||
>true ? 1 : {} : {}
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>{} : {}
|
||||
@@ -67,8 +67,8 @@ var r5 = true ? b : a; // typeof b
|
||||
>a : { x: number; y?: number; }
|
||||
|
||||
var r6 = true ? (x: number) => { } : (x: Object) => { }; // returns number => void
|
||||
>r6 : ((x: number) => void) | ((x: Object) => void)
|
||||
>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void)
|
||||
>r6 : (x: number) => void
|
||||
>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void
|
||||
>true : boolean
|
||||
>(x: number) => { } : (x: number) => void
|
||||
>x : number
|
||||
@@ -80,7 +80,7 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { };
|
||||
>r7 : (x: Object) => void
|
||||
>x : Object
|
||||
>Object : Object
|
||||
>true ? (x: number) => { } : (x: Object) => { } : ((x: number) => void) | ((x: Object) => void)
|
||||
>true ? (x: number) => { } : (x: Object) => { } : (x: number) => void
|
||||
>true : boolean
|
||||
>(x: number) => { } : (x: number) => void
|
||||
>x : number
|
||||
@@ -89,8 +89,8 @@ var r7: (x: Object) => void = true ? (x: number) => { } : (x: Object) => { };
|
||||
>Object : Object
|
||||
|
||||
var r8 = true ? (x: Object) => { } : (x: number) => { }; // returns Object => void
|
||||
>r8 : ((x: Object) => void) | ((x: number) => void)
|
||||
>true ? (x: Object) => { } : (x: number) => { } : ((x: Object) => void) | ((x: number) => void)
|
||||
>r8 : (x: Object) => void
|
||||
>true ? (x: Object) => { } : (x: number) => { } : (x: Object) => void
|
||||
>true : boolean
|
||||
>(x: Object) => { } : (x: Object) => void
|
||||
>x : Object
|
||||
@@ -107,8 +107,8 @@ var r10: Base = true ? derived : derived2; // no error since we use the contextu
|
||||
>derived2 : Derived2
|
||||
|
||||
var r11 = true ? base : derived2;
|
||||
>r11 : Base | Derived2
|
||||
>true ? base : derived2 : Base | Derived2
|
||||
>r11 : Base
|
||||
>true ? base : derived2 : Base
|
||||
>true : boolean
|
||||
>base : Base
|
||||
>derived2 : Derived2
|
||||
|
||||
@@ -27,43 +27,43 @@ var z: Z;
|
||||
|
||||
// All these arrays should be X[]
|
||||
var b1 = [x, y, z];
|
||||
>b1 : (X | Y | Z)[]
|
||||
>[x, y, z] : (X | Y | Z)[]
|
||||
>b1 : X[]
|
||||
>[x, y, z] : X[]
|
||||
>x : X
|
||||
>y : Y
|
||||
>z : Z
|
||||
|
||||
var b2 = [x, z, y];
|
||||
>b2 : (X | Z | Y)[]
|
||||
>[x, z, y] : (X | Z | Y)[]
|
||||
>b2 : X[]
|
||||
>[x, z, y] : X[]
|
||||
>x : X
|
||||
>z : Z
|
||||
>y : Y
|
||||
|
||||
var b3 = [y, x, z];
|
||||
>b3 : (Y | X | Z)[]
|
||||
>[y, x, z] : (Y | X | Z)[]
|
||||
>b3 : X[]
|
||||
>[y, x, z] : X[]
|
||||
>y : Y
|
||||
>x : X
|
||||
>z : Z
|
||||
|
||||
var b4 = [y, z, x];
|
||||
>b4 : (Y | Z | X)[]
|
||||
>[y, z, x] : (Y | Z | X)[]
|
||||
>b4 : X[]
|
||||
>[y, z, x] : X[]
|
||||
>y : Y
|
||||
>z : Z
|
||||
>x : X
|
||||
|
||||
var b5 = [z, x, y];
|
||||
>b5 : (Z | X | Y)[]
|
||||
>[z, x, y] : (Z | X | Y)[]
|
||||
>b5 : X[]
|
||||
>[z, x, y] : X[]
|
||||
>z : Z
|
||||
>x : X
|
||||
>y : Y
|
||||
|
||||
var b6 = [z, y, x];
|
||||
>b6 : (Z | Y | X)[]
|
||||
>[z, y, x] : (Z | Y | X)[]
|
||||
>b6 : X[]
|
||||
>[z, y, x] : X[]
|
||||
>z : Z
|
||||
>y : Y
|
||||
>x : X
|
||||
|
||||
@@ -31,21 +31,21 @@ var b: B;
|
||||
//Cond ? Expr1 : Expr2, Expr1 is supertype
|
||||
//Be Not contextually typed
|
||||
true ? x : a;
|
||||
>true ? x : a : X | A
|
||||
>true ? x : a : X
|
||||
>true : boolean
|
||||
>x : X
|
||||
>a : A
|
||||
|
||||
var result1 = true ? x : a;
|
||||
>result1 : X | A
|
||||
>true ? x : a : X | A
|
||||
>result1 : X
|
||||
>true ? x : a : X
|
||||
>true : boolean
|
||||
>x : X
|
||||
>a : A
|
||||
|
||||
//Expr1 and Expr2 are literals
|
||||
true ? {} : 1;
|
||||
>true ? {} : 1 : {} | number
|
||||
>true ? {} : 1 : {}
|
||||
>true : boolean
|
||||
>{} : {}
|
||||
>1 : number
|
||||
@@ -63,8 +63,8 @@ true ? { a: 1 } : { a: 2, b: 'string' };
|
||||
>'string' : string
|
||||
|
||||
var result2 = true ? {} : 1;
|
||||
>result2 : {} | number
|
||||
>true ? {} : 1 : {} | number
|
||||
>result2 : {}
|
||||
>true ? {} : 1 : {}
|
||||
>true : boolean
|
||||
>{} : {}
|
||||
>1 : number
|
||||
@@ -86,7 +86,7 @@ var result3 = true ? { a: 1 } : { a: 2, b: 'string' };
|
||||
var resultIsX1: X = true ? x : a;
|
||||
>resultIsX1 : X
|
||||
>X : X
|
||||
>true ? x : a : X | A
|
||||
>true ? x : a : X
|
||||
>true : boolean
|
||||
>x : X
|
||||
>a : A
|
||||
@@ -95,7 +95,7 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA;
|
||||
>result4 : (t: A) => any
|
||||
>t : A
|
||||
>A : A
|
||||
>true ? (m) => m.propertyX : (n) => n.propertyA : ((m: A) => any) | ((n: A) => number)
|
||||
>true ? (m) => m.propertyX : (n) => n.propertyA : (m: A) => any
|
||||
>true : boolean
|
||||
>(m) => m.propertyX : (m: A) => any
|
||||
>m : A
|
||||
@@ -111,21 +111,21 @@ var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA;
|
||||
//Cond ? Expr1 : Expr2, Expr2 is supertype
|
||||
//Be Not contextually typed
|
||||
true ? a : x;
|
||||
>true ? a : x : A | X
|
||||
>true ? a : x : X
|
||||
>true : boolean
|
||||
>a : A
|
||||
>x : X
|
||||
|
||||
var result5 = true ? a : x;
|
||||
>result5 : A | X
|
||||
>true ? a : x : A | X
|
||||
>result5 : X
|
||||
>true ? a : x : X
|
||||
>true : boolean
|
||||
>a : A
|
||||
>x : X
|
||||
|
||||
//Expr1 and Expr2 are literals
|
||||
true ? 1 : {};
|
||||
>true ? 1 : {} : number | {}
|
||||
>true ? 1 : {} : {}
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>{} : {}
|
||||
@@ -143,8 +143,8 @@ true ? { a: 2, b: 'string' } : { a: 1 };
|
||||
>1 : number
|
||||
|
||||
var result6 = true ? 1 : {};
|
||||
>result6 : number | {}
|
||||
>true ? 1 : {} : number | {}
|
||||
>result6 : {}
|
||||
>true ? 1 : {} : {}
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>{} : {}
|
||||
@@ -166,7 +166,7 @@ var result7 = true ? { a: 2, b: 'string' } : { a: 1 };
|
||||
var resultIsX2: X = true ? x : a;
|
||||
>resultIsX2 : X
|
||||
>X : X
|
||||
>true ? x : a : X | A
|
||||
>true ? x : a : X
|
||||
>true : boolean
|
||||
>x : X
|
||||
>a : A
|
||||
@@ -175,7 +175,7 @@ var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX;
|
||||
>result8 : (t: A) => any
|
||||
>t : A
|
||||
>A : A
|
||||
>true ? (m) => m.propertyA : (n) => n.propertyX : ((m: A) => number) | ((n: A) => any)
|
||||
>true ? (m) => m.propertyA : (n) => n.propertyX : (n: A) => any
|
||||
>true : boolean
|
||||
>(m) => m.propertyA : (m: A) => number
|
||||
>m : A
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'.
|
||||
tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'.
|
||||
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2651: A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums.
|
||||
tests/cases/compiler/constEnumErrors.ts(12,9): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression.
|
||||
tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression.
|
||||
tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal.
|
||||
@@ -31,7 +31,7 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member
|
||||
// forward reference to the element of the same enum
|
||||
X = Y,
|
||||
~
|
||||
!!! error TS2651: A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums.
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
// forward reference to the element of the same enum
|
||||
Y = E1.Z,
|
||||
~~~~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/contextualTyping12.ts(1,13): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
tests/cases/compiler/contextualTyping12.ts(1,57): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/contextualTyping12.ts(1,13): error TS2322: Type '({ id: num
|
||||
|
||||
==== tests/cases/compiler/contextualTyping12.ts (1 errors) ====
|
||||
class foo { public bar:{id:number;}[] = [{id:1}, {id:2, name:"foo"}]; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/contextualTyping17.ts(1,33): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
tests/cases/compiler/contextualTyping17.ts(1,47): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping17.ts (1 errors) ====
|
||||
var foo: {id:number;} = {id:4}; foo = {id: 5, name:"foo"};
|
||||
~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/contextualTyping2.ts(1,5): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
tests/cases/compiler/contextualTyping2.ts(1,32): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping2.ts (1 errors) ====
|
||||
var foo: {id:number;} = {id:4, name:"foo"};
|
||||
~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/contextualTyping20.ts(1,36): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
tests/cases/compiler/contextualTyping20.ts(1,58): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/contextualTyping20.ts(1,36): error TS2322: Type '({ id: num
|
||||
|
||||
==== tests/cases/compiler/contextualTyping20.ts (1 errors) ====
|
||||
var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, {id:2, name:"foo"}];
|
||||
~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/contextualTyping4.ts(1,13): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
tests/cases/compiler/contextualTyping4.ts(1,46): error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping4.ts (1 errors) ====
|
||||
class foo { public bar:{id:number;} = {id:5, name:"foo"}; }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/contextualTyping9.ts(1,5): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
tests/cases/compiler/contextualTyping9.ts(1,42): error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ id: number; }'.
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/contextualTyping9.ts(1,5): error TS2322: Type '({ id: numbe
|
||||
|
||||
==== tests/cases/compiler/contextualTyping9.ts (1 errors) ====
|
||||
var foo:{id:number;}[] = [{id:1}, {id:2, name:"foo"}];
|
||||
~~~
|
||||
~~~~~~~~~~
|
||||
!!! error TS2322: Type '({ id: number; } | { id: number; name: string; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type '{ id: number; } | { id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type '{ id: number; }'.
|
||||
|
||||
@@ -23,8 +23,8 @@ class C extends A {
|
||||
}
|
||||
|
||||
var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }];
|
||||
>xs : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[]
|
||||
>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : (((x: A) => void) | ((x: B) => void) | ((x: C) => void))[]
|
||||
>xs : ((x: A) => void)[]
|
||||
>[(x: A) => { }, (x: B) => { }, (x: C) => { }] : ((x: A) => void)[]
|
||||
>(x: A) => { } : (x: A) => void
|
||||
>x : A
|
||||
>A : A
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [declFileClassExtendsNull.ts]
|
||||
|
||||
class ExtendsNull extends null {
|
||||
}
|
||||
|
||||
//// [declFileClassExtendsNull.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 ExtendsNull = (function (_super) {
|
||||
__extends(ExtendsNull, _super);
|
||||
function ExtendsNull() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return ExtendsNull;
|
||||
})(null);
|
||||
|
||||
|
||||
//// [declFileClassExtendsNull.d.ts]
|
||||
declare class ExtendsNull extends null {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/declFileClassExtendsNull.ts ===
|
||||
|
||||
class ExtendsNull extends null {
|
||||
>ExtendsNull : Symbol(ExtendsNull, Decl(declFileClassExtendsNull.ts, 0, 0))
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/compiler/declFileClassExtendsNull.ts ===
|
||||
|
||||
class ExtendsNull extends null {
|
||||
>ExtendsNull : ExtendsNull
|
||||
>null : null
|
||||
}
|
||||
@@ -34,6 +34,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var service_1 = require("./service");
|
||||
var MyComponent = (function () {
|
||||
function MyComponent(Service) {
|
||||
this.Service = Service;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [decoratorMetadataOnInferredType.ts]
|
||||
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
};
|
||||
|
||||
class A {
|
||||
constructor() { console.log('new A'); }
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
}
|
||||
|
||||
export class B {
|
||||
@decorator
|
||||
x = new A();
|
||||
}
|
||||
|
||||
|
||||
//// [decoratorMetadataOnInferredType.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
console.log('new A');
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
function decorator(target, propertyKey) {
|
||||
}
|
||||
var B = (function () {
|
||||
function B() {
|
||||
this.x = new A();
|
||||
}
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Object)
|
||||
], B.prototype, "x");
|
||||
return B;
|
||||
})();
|
||||
exports.B = B;
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/decoratorMetadataOnInferredType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : Symbol(console, Decl(decoratorMetadataOnInferredType.ts, 1, 11))
|
||||
|
||||
log(msg: string): void;
|
||||
>log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22))
|
||||
>msg : Symbol(msg, Decl(decoratorMetadataOnInferredType.ts, 2, 8))
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(decoratorMetadataOnInferredType.ts, 3, 2))
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22))
|
||||
>console : Symbol(console, Decl(decoratorMetadataOnInferredType.ts, 1, 11))
|
||||
>log : Symbol(log, Decl(decoratorMetadataOnInferredType.ts, 1, 22))
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataOnInferredType.ts, 7, 1))
|
||||
>target : Symbol(target, Decl(decoratorMetadataOnInferredType.ts, 9, 19))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||
>propertyKey : Symbol(propertyKey, Decl(decoratorMetadataOnInferredType.ts, 9, 34))
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : Symbol(B, Decl(decoratorMetadataOnInferredType.ts, 10, 1))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataOnInferredType.ts, 7, 1))
|
||||
|
||||
x = new A();
|
||||
>x : Symbol(x, Decl(decoratorMetadataOnInferredType.ts, 12, 16))
|
||||
>A : Symbol(A, Decl(decoratorMetadataOnInferredType.ts, 3, 2))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
=== tests/cases/compiler/decoratorMetadataOnInferredType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : { log(msg: string): void; }
|
||||
|
||||
log(msg: string): void;
|
||||
>log : (msg: string) => void
|
||||
>msg : string
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log('new A') : void
|
||||
>console.log : (msg: string) => void
|
||||
>console : { log(msg: string): void; }
|
||||
>log : (msg: string) => void
|
||||
>'new A' : string
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
>target : Object
|
||||
>Object : Object
|
||||
>propertyKey : string
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : B
|
||||
|
||||
@decorator
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
|
||||
x = new A();
|
||||
>x : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [decoratorMetadataWithConstructorType.ts]
|
||||
|
||||
declare var console: {
|
||||
log(msg: string): void;
|
||||
};
|
||||
|
||||
class A {
|
||||
constructor() { console.log('new A'); }
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
}
|
||||
|
||||
export class B {
|
||||
@decorator
|
||||
x: A = new A();
|
||||
}
|
||||
|
||||
|
||||
//// [decoratorMetadataWithConstructorType.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
console.log('new A');
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
function decorator(target, propertyKey) {
|
||||
}
|
||||
var B = (function () {
|
||||
function B() {
|
||||
this.x = new A();
|
||||
}
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', A)
|
||||
], B.prototype, "x");
|
||||
return B;
|
||||
})();
|
||||
exports.B = B;
|
||||
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11))
|
||||
|
||||
log(msg: string): void;
|
||||
>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
>msg : Symbol(msg, Decl(decoratorMetadataWithConstructorType.ts, 2, 8))
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11))
|
||||
>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22))
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1))
|
||||
>target : Symbol(target, Decl(decoratorMetadataWithConstructorType.ts, 9, 19))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||
>propertyKey : Symbol(propertyKey, Decl(decoratorMetadataWithConstructorType.ts, 9, 34))
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : Symbol(B, Decl(decoratorMetadataWithConstructorType.ts, 10, 1))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1))
|
||||
|
||||
x: A = new A();
|
||||
>x : Symbol(x, Decl(decoratorMetadataWithConstructorType.ts, 12, 16))
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts ===
|
||||
|
||||
declare var console: {
|
||||
>console : { log(msg: string): void; }
|
||||
|
||||
log(msg: string): void;
|
||||
>log : (msg: string) => void
|
||||
>msg : string
|
||||
|
||||
};
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
constructor() { console.log('new A'); }
|
||||
>console.log('new A') : void
|
||||
>console.log : (msg: string) => void
|
||||
>console : { log(msg: string): void; }
|
||||
>log : (msg: string) => void
|
||||
>'new A' : string
|
||||
}
|
||||
|
||||
function decorator(target: Object, propertyKey: string) {
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
>target : Object
|
||||
>Object : Object
|
||||
>propertyKey : string
|
||||
}
|
||||
|
||||
export class B {
|
||||
>B : B
|
||||
|
||||
@decorator
|
||||
>decorator : (target: Object, propertyKey: string) => void
|
||||
|
||||
x: A = new A();
|
||||
>x : A
|
||||
>A : A
|
||||
>new A() : A
|
||||
>A : typeof A
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import {db} from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db;
|
||||
|
||||
constructor(db: db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db} from './db';
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
constructor(db: db) {
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 8))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db} from './db';
|
||||
>db : typeof db
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: db;
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
constructor(db: db) {
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : db
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import {db as Database} from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: Database;
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db as Database} from './db';
|
||||
>db : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: Database;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>Database : Symbol(Database, Decl(service.ts, 0, 8))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import {db as Database} from './db';
|
||||
>db : typeof Database
|
||||
>Database : typeof Database
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: Database;
|
||||
>db : Database
|
||||
>Database : Database
|
||||
|
||||
constructor(db: Database) { // no collision
|
||||
>db : Database
|
||||
>Database : Database
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : Database
|
||||
>this.db : Database
|
||||
>this : MyClass
|
||||
>db : Database
|
||||
>db : Database
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : Database
|
||||
>this : MyClass
|
||||
>db : Database
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db = require('./db');
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: db.db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(db.db, Decl(db.ts, 0, 0))
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(db.db, Decl(db.ts, 0, 0))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db = require('./db');
|
||||
>db : typeof db
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: db.db;
|
||||
>db : db.db
|
||||
>db : any
|
||||
>db : db.db
|
||||
|
||||
constructor(db: db.db) { // collision with namespace of external module db
|
||||
>db : db.db
|
||||
>db : any
|
||||
>db : db.db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : db.db
|
||||
>this.db : db.db
|
||||
>this : MyClass
|
||||
>db : db.db
|
||||
>db : db.db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : db.db
|
||||
>this : MyClass
|
||||
>db : db.db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
tests/cases/compiler/service.ts(1,8): error TS1192: Module '"tests/cases/compiler/db"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/db.ts (0 errors) ====
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/service.ts (1 errors) ====
|
||||
import db from './db'; // error no default export
|
||||
~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/db"' has no default export.
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db from './db'; // error no default export
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db;
|
||||
|
||||
constructor(db: db.db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db'); // error no default export
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
@@ -0,0 +1,52 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export default class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db;
|
||||
|
||||
constructor(db: db) { // collision
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export default class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db from './db';
|
||||
>db : Symbol(db, Decl(service.ts, 0, 6))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 6))
|
||||
|
||||
constructor(db: db) { // collision
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>db : Symbol(db, Decl(service.ts, 0, 6))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export default class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import db from './db';
|
||||
>db : typeof db
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: db;
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
constructor(db: db) { // collision
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : db
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>db : db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : db
|
||||
>this : MyClass
|
||||
>db : db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export default class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import database from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: database;
|
||||
|
||||
constructor(db: database) { // no collision
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export default class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import database from './db';
|
||||
>database : Symbol(database, Decl(service.ts, 0, 6))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: database;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>database : Symbol(database, Decl(service.ts, 0, 6))
|
||||
|
||||
constructor(db: database) { // no collision
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>database : Symbol(database, Decl(service.ts, 0, 6))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export default class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import database from './db';
|
||||
>database : typeof database
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: database;
|
||||
>db : database
|
||||
>database : database
|
||||
|
||||
constructor(db: database) { // no collision
|
||||
>db : database
|
||||
>database : database
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : database
|
||||
>this.db : database
|
||||
>this : MyClass
|
||||
>db : database
|
||||
>db : database
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : database
|
||||
>this : MyClass
|
||||
>db : database
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
tests/cases/compiler/service.ts(7,9): error TS2503: Cannot find namespace 'db'.
|
||||
tests/cases/compiler/service.ts(9,21): error TS2503: Cannot find namespace 'db'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/db.ts (0 errors) ====
|
||||
export default class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/service.ts (2 errors) ====
|
||||
import db from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db; //error
|
||||
~~
|
||||
!!! error TS2503: Cannot find namespace 'db'.
|
||||
|
||||
constructor(db: db.db) { // error
|
||||
~~
|
||||
!!! error TS2503: Cannot find namespace 'db'.
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision7.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export default class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import db from './db';
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: db.db; //error
|
||||
|
||||
constructor(db: db.db) { // error
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = db;
|
||||
//// [service.js]
|
||||
var db_1 = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
@@ -0,0 +1,51 @@
|
||||
//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts] ////
|
||||
|
||||
//// [db.ts]
|
||||
export class db {
|
||||
public doSomething() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [service.ts]
|
||||
import database = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
@someDecorator
|
||||
class MyClass {
|
||||
db: database.db;
|
||||
|
||||
constructor(db: database.db) { // no collision
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
|
||||
|
||||
//// [db.js]
|
||||
var db = (function () {
|
||||
function db() {
|
||||
}
|
||||
db.prototype.doSomething = function () {
|
||||
};
|
||||
return db;
|
||||
})();
|
||||
exports.db = db;
|
||||
//// [service.js]
|
||||
var database = require('./db');
|
||||
function someDecorator(target) {
|
||||
return target;
|
||||
}
|
||||
var MyClass = (function () {
|
||||
function MyClass(db) {
|
||||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [database.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import database = require('./db');
|
||||
>database : Symbol(database, Decl(service.ts, 0, 0))
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 34))
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
|
||||
return target;
|
||||
>target : Symbol(target, Decl(service.ts, 1, 23))
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 34))
|
||||
|
||||
class MyClass {
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
|
||||
db: database.db;
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>database : Symbol(database, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(database.db, Decl(db.ts, 0, 0))
|
||||
|
||||
constructor(db: database.db) { // no collision
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
>database : Symbol(database, Decl(service.ts, 0, 0))
|
||||
>db : Symbol(database.db, Decl(db.ts, 0, 0))
|
||||
|
||||
this.db = db;
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>db : Symbol(db, Decl(service.ts, 8, 16))
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17))
|
||||
>this.db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>this : Symbol(MyClass, Decl(service.ts, 3, 1))
|
||||
>db : Symbol(db, Decl(service.ts, 5, 15))
|
||||
>doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8))
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : Symbol(db, Decl(db.ts, 0, 0))
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/service.ts ===
|
||||
import database = require('./db');
|
||||
>database : typeof database
|
||||
|
||||
function someDecorator(target) {
|
||||
>someDecorator : (target: any) => any
|
||||
>target : any
|
||||
|
||||
return target;
|
||||
>target : any
|
||||
}
|
||||
@someDecorator
|
||||
>someDecorator : (target: any) => any
|
||||
|
||||
class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
db: database.db;
|
||||
>db : database.db
|
||||
>database : any
|
||||
>db : database.db
|
||||
|
||||
constructor(db: database.db) { // no collision
|
||||
>db : database.db
|
||||
>database : any
|
||||
>db : database.db
|
||||
|
||||
this.db = db;
|
||||
>this.db = db : database.db
|
||||
>this.db : database.db
|
||||
>this : MyClass
|
||||
>db : database.db
|
||||
>db : database.db
|
||||
|
||||
this.db.doSomething();
|
||||
>this.db.doSomething() : void
|
||||
>this.db.doSomething : () => void
|
||||
>this.db : database.db
|
||||
>this : MyClass
|
||||
>db : database.db
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
export {MyClass};
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
=== tests/cases/compiler/db.ts ===
|
||||
export class db {
|
||||
>db : db
|
||||
|
||||
public doSomething() {
|
||||
>doSomething : () => void
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts(14,28): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclarations/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts(14,36): error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/memberFunctionDeclara
|
||||
bar() {
|
||||
var r = super.foo({ a: 1 }); // { a: number }
|
||||
var r2 = super.foo({ a: 1, b: 2 }); // { a: number }
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ a: number; b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
var r3 = this.foo({ a: 1, b: 2 }); // { a: number; b: number; }
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,51): error TS2339: Property 'x3' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,62): error TS2339: Property 'y' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(7,72): error TS2339: Property 'z' does not exist on type 'C1'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,16): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(11,19): error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
||||
Object literal may only specify known properties, and 'x1' does not exist in type '{ x: number; y: string; z: boolean; }'.
|
||||
@@ -43,7 +43,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties5.ts(1
|
||||
}
|
||||
|
||||
var a = new C1([{ x1: 10, x2: "", x3: true }, "", false]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2345: Argument of type '[{ x1: number; x2: string; x3: boolean; }, string, boolean]' is not assignable to parameter of type '[{ x: number; y: string; z: boolean; }, number, string]'.
|
||||
!!! error TS2345: Types of property '0' are incompatible.
|
||||
!!! error TS2345: Type '{ x1: number; x2: string; x3: boolean; }' is not assignable to type '{ x: number; y: string; z: boolean; }'.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [excessPropertyErrorsSuppressed.ts]
|
||||
|
||||
var x: { a: string } = { a: "hello", b: 42 }; // No error
|
||||
|
||||
|
||||
//// [excessPropertyErrorsSuppressed.js]
|
||||
var x = { a: "hello", b: 42 }; // No error
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/excessPropertyErrorsSuppressed.ts ===
|
||||
|
||||
var x: { a: string } = { a: "hello", b: 42 }; // No error
|
||||
>x : Symbol(x, Decl(excessPropertyErrorsSuppressed.ts, 1, 3))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorsSuppressed.ts, 1, 8))
|
||||
>a : Symbol(a, Decl(excessPropertyErrorsSuppressed.ts, 1, 24))
|
||||
>b : Symbol(b, Decl(excessPropertyErrorsSuppressed.ts, 1, 36))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/excessPropertyErrorsSuppressed.ts ===
|
||||
|
||||
var x: { a: string } = { a: "hello", b: 42 }; // No error
|
||||
>x : { a: string; }
|
||||
>a : string
|
||||
>{ a: "hello", b: 42 } : { a: string; b: number; }
|
||||
>a : string
|
||||
>"hello" : string
|
||||
>b : number
|
||||
>42 : number
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D<string>)[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
|
||||
@@ -79,7 +79,7 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
for( var arr = [new C(), new C2(), new D<string>()];;){}
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D<string>)[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
|
||||
for(var arr2 = [new D<string>()];;){}
|
||||
for( var arr2 = new Array<D<number>>();;){}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
tests/cases/compiler/forwardRefInEnum.ts(4,9): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
tests/cases/compiler/forwardRefInEnum.ts(5,10): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
tests/cases/compiler/forwardRefInEnum.ts(7,9): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
tests/cases/compiler/forwardRefInEnum.ts(8,10): error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
|
||||
|
||||
==== tests/cases/compiler/forwardRefInEnum.ts (4 errors) ====
|
||||
enum E1 {
|
||||
// illegal case
|
||||
// forward reference to the element of the same enum
|
||||
X = Y,
|
||||
~
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
X1 = E1["Y"],
|
||||
~~~~~~~
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
// forward reference to the element of the same enum
|
||||
Y = E1.Z,
|
||||
~~~~
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
Y1 = E1["Z"]
|
||||
~~~~~~~
|
||||
!!! error TS2651: A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.
|
||||
}
|
||||
|
||||
enum E1 {
|
||||
Z = 4
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [forwardRefInEnum.ts]
|
||||
enum E1 {
|
||||
// illegal case
|
||||
// forward reference to the element of the same enum
|
||||
X = Y,
|
||||
X1 = E1["Y"],
|
||||
// forward reference to the element of the same enum
|
||||
Y = E1.Z,
|
||||
Y1 = E1["Z"]
|
||||
}
|
||||
|
||||
enum E1 {
|
||||
Z = 4
|
||||
}
|
||||
|
||||
|
||||
//// [forwardRefInEnum.js]
|
||||
var E1;
|
||||
(function (E1) {
|
||||
// illegal case
|
||||
// forward reference to the element of the same enum
|
||||
E1[E1["X"] = E1.Y] = "X";
|
||||
E1[E1["X1"] = E1["Y"]] = "X1";
|
||||
// forward reference to the element of the same enum
|
||||
E1[E1["Y"] = E1.Z] = "Y";
|
||||
E1[E1["Y1"] = E1["Z"]] = "Y1";
|
||||
})(E1 || (E1 = {}));
|
||||
var E1;
|
||||
(function (E1) {
|
||||
E1[E1["Z"] = 4] = "Z";
|
||||
})(E1 || (E1 = {}));
|
||||
@@ -342,7 +342,7 @@ var f7: (x: number) => string | number = x => { // should be (x: number) => numb
|
||||
var f8: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f8 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base | Derived2
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived2();} : (x: number) => Base
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
@@ -356,7 +356,7 @@ var f8: (x: number) => any = x => { // should be (x: number) => Base
|
||||
var f9: (x: number) => any = x => { // should be (x: number) => Base
|
||||
>f9 : (x: number) => any
|
||||
>x : number
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base | Derived | Derived2
|
||||
>x => { // should be (x: number) => Base return new Base(); return new Derived(); return new Derived2();} : (x: number) => Base
|
||||
>x : number
|
||||
|
||||
return new Base();
|
||||
|
||||
@@ -2125,8 +2125,8 @@ var x216 = <Genric<Base>>{ func: n => { return [d1, d2]; } };
|
||||
>d2 : Derived2
|
||||
|
||||
var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] };
|
||||
>x217 : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>(<() => Base[]>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>x217 : () => Base[]
|
||||
>(<() => Base[]>undefined) || function() { return [d1, d2] } : () => Base[]
|
||||
>(<() => Base[]>undefined) : () => Base[]
|
||||
><() => Base[]>undefined : () => Base[]
|
||||
>Base : Base
|
||||
@@ -2137,8 +2137,8 @@ var x217 = (<() => Base[]>undefined) || function() { return [d1, d2] };
|
||||
>d2 : Derived2
|
||||
|
||||
var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] };
|
||||
>x218 : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>(<() => Base[]>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>x218 : () => Base[]
|
||||
>(<() => Base[]>undefined) || function named() { return [d1, d2] } : () => Base[]
|
||||
>(<() => Base[]>undefined) : () => Base[]
|
||||
><() => Base[]>undefined : () => Base[]
|
||||
>Base : Base
|
||||
@@ -2150,8 +2150,8 @@ var x218 = (<() => Base[]>undefined) || function named() { return [d1, d2] };
|
||||
>d2 : Derived2
|
||||
|
||||
var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] };
|
||||
>x219 : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>x219 : () => Base[]
|
||||
>(<{ (): Base[]; }>undefined) || function() { return [d1, d2] } : () => Base[]
|
||||
>(<{ (): Base[]; }>undefined) : () => Base[]
|
||||
><{ (): Base[]; }>undefined : () => Base[]
|
||||
>Base : Base
|
||||
@@ -2162,8 +2162,8 @@ var x219 = (<{ (): Base[]; }>undefined) || function() { return [d1, d2] };
|
||||
>d2 : Derived2
|
||||
|
||||
var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] };
|
||||
>x220 : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : (() => Base[]) | (() => (Derived1 | Derived2)[])
|
||||
>x220 : () => Base[]
|
||||
>(<{ (): Base[]; }>undefined) || function named() { return [d1, d2] } : () => Base[]
|
||||
>(<{ (): Base[]; }>undefined) : () => Base[]
|
||||
><{ (): Base[]; }>undefined : () => Base[]
|
||||
>Base : Base
|
||||
@@ -2175,8 +2175,8 @@ var x220 = (<{ (): Base[]; }>undefined) || function named() { return [d1, d2] };
|
||||
>d2 : Derived2
|
||||
|
||||
var x221 = (<Base[]>undefined) || [d1, d2];
|
||||
>x221 : Base[] | (Derived1 | Derived2)[]
|
||||
>(<Base[]>undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[]
|
||||
>x221 : Base[]
|
||||
>(<Base[]>undefined) || [d1, d2] : Base[]
|
||||
>(<Base[]>undefined) : Base[]
|
||||
><Base[]>undefined : Base[]
|
||||
>Base : Base
|
||||
@@ -2186,8 +2186,8 @@ var x221 = (<Base[]>undefined) || [d1, d2];
|
||||
>d2 : Derived2
|
||||
|
||||
var x222 = (<Array<Base>>undefined) || [d1, d2];
|
||||
>x222 : Base[] | (Derived1 | Derived2)[]
|
||||
>(<Array<Base>>undefined) || [d1, d2] : Base[] | (Derived1 | Derived2)[]
|
||||
>x222 : Base[]
|
||||
>(<Array<Base>>undefined) || [d1, d2] : Base[]
|
||||
>(<Array<Base>>undefined) : Base[]
|
||||
><Array<Base>>undefined : Base[]
|
||||
>Array : T[]
|
||||
@@ -2198,8 +2198,8 @@ var x222 = (<Array<Base>>undefined) || [d1, d2];
|
||||
>d2 : Derived2
|
||||
|
||||
var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2];
|
||||
>x223 : { [n: number]: Base; } | (Derived1 | Derived2)[]
|
||||
>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; } | (Derived1 | Derived2)[]
|
||||
>x223 : { [n: number]: Base; }
|
||||
>(<{ [n: number]: Base; }>undefined) || [d1, d2] : { [n: number]: Base; }
|
||||
>(<{ [n: number]: Base; }>undefined) : { [n: number]: Base; }
|
||||
><{ [n: number]: Base; }>undefined : { [n: number]: Base; }
|
||||
>n : number
|
||||
@@ -2210,8 +2210,8 @@ var x223 = (<{ [n: number]: Base; }>undefined) || [d1, d2];
|
||||
>d2 : Derived2
|
||||
|
||||
var x224 = (<{n: Base[]; } >undefined) || { n: [d1, d2] };
|
||||
>x224 : { n: Base[]; } | { n: (Derived1 | Derived2)[]; }
|
||||
>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; } | { n: (Derived1 | Derived2)[]; }
|
||||
>x224 : { n: Base[]; }
|
||||
>(<{n: Base[]; } >undefined) || { n: [d1, d2] } : { n: Base[]; }
|
||||
>(<{n: Base[]; } >undefined) : { n: Base[]; }
|
||||
><{n: Base[]; } >undefined : { n: Base[]; }
|
||||
>n : Base[]
|
||||
|
||||
@@ -21,14 +21,14 @@ var c = [1, '', null]; // {}[]
|
||||
>null : null
|
||||
|
||||
var d = [{}, 1]; // {}[]
|
||||
>d : ({} | number)[]
|
||||
>[{}, 1] : ({} | number)[]
|
||||
>d : {}[]
|
||||
>[{}, 1] : {}[]
|
||||
>{} : {}
|
||||
>1 : number
|
||||
|
||||
var e = [{}, Object]; // {}[]
|
||||
>e : ({} | ObjectConstructor)[]
|
||||
>[{}, Object] : ({} | ObjectConstructor)[]
|
||||
>e : {}[]
|
||||
>[{}, Object] : {}[]
|
||||
>{} : {}
|
||||
>Object : ObjectConstructor
|
||||
|
||||
@@ -88,16 +88,16 @@ var k = [() => 1, () => 1]; // { (): number }[]
|
||||
>1 : number
|
||||
|
||||
var l = [() => 1, () => null]; // { (): any }[]
|
||||
>l : ((() => number) | (() => any))[]
|
||||
>[() => 1, () => null] : ((() => number) | (() => any))[]
|
||||
>l : (() => any)[]
|
||||
>[() => 1, () => null] : (() => any)[]
|
||||
>() => 1 : () => number
|
||||
>1 : number
|
||||
>() => null : () => any
|
||||
>null : null
|
||||
|
||||
var m = [() => 1, () => '', () => null]; // { (): any }[]
|
||||
>m : ((() => number) | (() => string) | (() => any))[]
|
||||
>[() => 1, () => '', () => null] : ((() => number) | (() => string) | (() => any))[]
|
||||
>m : (() => any)[]
|
||||
>[() => 1, () => '', () => null] : (() => any)[]
|
||||
>() => 1 : () => number
|
||||
>1 : number
|
||||
>() => '' : () => string
|
||||
@@ -169,8 +169,8 @@ module Derived {
|
||||
>derived : Derived
|
||||
|
||||
var j = [() => base, () => derived]; // { {}: Base }
|
||||
>j : ((() => Base) | (() => Derived))[]
|
||||
>[() => base, () => derived] : ((() => Base) | (() => Derived))[]
|
||||
>j : (() => Base)[]
|
||||
>[() => base, () => derived] : (() => Base)[]
|
||||
>() => base : () => Base
|
||||
>base : Base
|
||||
>() => derived : () => Derived
|
||||
@@ -185,16 +185,16 @@ module Derived {
|
||||
>1 : number
|
||||
|
||||
var l = [() => base, () => null]; // { (): any }[]
|
||||
>l : ((() => Base) | (() => any))[]
|
||||
>[() => base, () => null] : ((() => Base) | (() => any))[]
|
||||
>l : (() => any)[]
|
||||
>[() => base, () => null] : (() => any)[]
|
||||
>() => base : () => Base
|
||||
>base : Base
|
||||
>() => null : () => any
|
||||
>null : null
|
||||
|
||||
var m = [() => base, () => derived, () => null]; // { (): any }[]
|
||||
>m : ((() => Base) | (() => Derived) | (() => any))[]
|
||||
>[() => base, () => derived, () => null] : ((() => Base) | (() => Derived) | (() => any))[]
|
||||
>m : (() => any)[]
|
||||
>[() => base, () => derived, () => null] : (() => any)[]
|
||||
>() => base : () => Base
|
||||
>base : Base
|
||||
>() => derived : () => Derived
|
||||
@@ -203,8 +203,8 @@ module Derived {
|
||||
>null : null
|
||||
|
||||
var n = [[() => base], [() => derived]]; // { (): Base }[]
|
||||
>n : ((() => Base)[] | (() => Derived)[])[]
|
||||
>[[() => base], [() => derived]] : ((() => Base)[] | (() => Derived)[])[]
|
||||
>n : (() => Base)[][]
|
||||
>[[() => base], [() => derived]] : (() => Base)[][]
|
||||
>[() => base] : (() => Base)[]
|
||||
>() => base : () => Base
|
||||
>base : Base
|
||||
@@ -219,8 +219,8 @@ module Derived {
|
||||
>derived2 : Derived2
|
||||
|
||||
var p = [derived, derived2, base]; // Base[]
|
||||
>p : (Derived | Derived2 | Base)[]
|
||||
>[derived, derived2, base] : (Derived | Derived2 | Base)[]
|
||||
>p : Base[]
|
||||
>[derived, derived2, base] : Base[]
|
||||
>derived : Derived
|
||||
>derived2 : Derived2
|
||||
>base : Base
|
||||
@@ -310,8 +310,8 @@ function foo<T, U>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var f = [() => t, () => u, () => null]; // { (): any }[]
|
||||
>f : ((() => T) | (() => U) | (() => any))[]
|
||||
>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[]
|
||||
>f : (() => any)[]
|
||||
>[() => t, () => u, () => null] : (() => any)[]
|
||||
>() => t : () => T
|
||||
>t : T
|
||||
>() => u : () => U
|
||||
@@ -364,8 +364,8 @@ function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var f = [() => t, () => u, () => null]; // { (): any }[]
|
||||
>f : ((() => T) | (() => U) | (() => any))[]
|
||||
>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[]
|
||||
>f : (() => any)[]
|
||||
>[() => t, () => u, () => null] : (() => any)[]
|
||||
>() => t : () => T
|
||||
>t : T
|
||||
>() => u : () => U
|
||||
@@ -374,8 +374,8 @@ function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
||||
>null : null
|
||||
|
||||
var g = [t, base]; // Base[]
|
||||
>g : (T | Base)[]
|
||||
>[t, base] : (T | Base)[]
|
||||
>g : Base[]
|
||||
>[t, base] : Base[]
|
||||
>t : T
|
||||
>base : Base
|
||||
|
||||
@@ -386,14 +386,14 @@ function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
||||
>derived : Derived
|
||||
|
||||
var i = [u, base]; // Base[]
|
||||
>i : (U | Base)[]
|
||||
>[u, base] : (U | Base)[]
|
||||
>i : Base[]
|
||||
>[u, base] : Base[]
|
||||
>u : U
|
||||
>base : Base
|
||||
|
||||
var j = [u, derived]; // Derived[]
|
||||
>j : (U | Derived)[]
|
||||
>[u, derived] : (U | Derived)[]
|
||||
>j : Derived[]
|
||||
>[u, derived] : Derived[]
|
||||
>u : U
|
||||
>derived : Derived
|
||||
}
|
||||
@@ -442,8 +442,8 @@ function foo3<T extends Derived, U extends Derived>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var f = [() => t, () => u, () => null]; // { (): any }[]
|
||||
>f : ((() => T) | (() => U) | (() => any))[]
|
||||
>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[]
|
||||
>f : (() => any)[]
|
||||
>[() => t, () => u, () => null] : (() => any)[]
|
||||
>() => t : () => T
|
||||
>t : T
|
||||
>() => u : () => U
|
||||
@@ -452,26 +452,26 @@ function foo3<T extends Derived, U extends Derived>(t: T, u: U) {
|
||||
>null : null
|
||||
|
||||
var g = [t, base]; // Base[]
|
||||
>g : (T | Base)[]
|
||||
>[t, base] : (T | Base)[]
|
||||
>g : Base[]
|
||||
>[t, base] : Base[]
|
||||
>t : T
|
||||
>base : Base
|
||||
|
||||
var h = [t, derived]; // Derived[]
|
||||
>h : (T | Derived)[]
|
||||
>[t, derived] : (T | Derived)[]
|
||||
>h : Derived[]
|
||||
>[t, derived] : Derived[]
|
||||
>t : T
|
||||
>derived : Derived
|
||||
|
||||
var i = [u, base]; // Base[]
|
||||
>i : (U | Base)[]
|
||||
>[u, base] : (U | Base)[]
|
||||
>i : Base[]
|
||||
>[u, base] : Base[]
|
||||
>u : U
|
||||
>base : Base
|
||||
|
||||
var j = [u, derived]; // Derived[]
|
||||
>j : (U | Derived)[]
|
||||
>[u, derived] : (U | Derived)[]
|
||||
>j : Derived[]
|
||||
>[u, derived] : Derived[]
|
||||
>u : U
|
||||
>derived : Derived
|
||||
}
|
||||
@@ -520,8 +520,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var f = [() => t, () => u, () => null]; // { (): any }[]
|
||||
>f : ((() => T) | (() => U) | (() => any))[]
|
||||
>[() => t, () => u, () => null] : ((() => T) | (() => U) | (() => any))[]
|
||||
>f : (() => any)[]
|
||||
>[() => t, () => u, () => null] : (() => any)[]
|
||||
>() => t : () => T
|
||||
>t : T
|
||||
>() => u : () => U
|
||||
@@ -530,8 +530,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>null : null
|
||||
|
||||
var g = [t, base]; // Base[]
|
||||
>g : (T | Base)[]
|
||||
>[t, base] : (T | Base)[]
|
||||
>g : Base[]
|
||||
>[t, base] : Base[]
|
||||
>t : T
|
||||
>base : Base
|
||||
|
||||
@@ -542,8 +542,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>derived : Derived
|
||||
|
||||
var i = [u, base]; // Base[]
|
||||
>i : (U | Base)[]
|
||||
>[u, base] : (U | Base)[]
|
||||
>i : Base[]
|
||||
>[u, base] : Base[]
|
||||
>u : U
|
||||
>base : Base
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type
|
||||
Types of property 'p1' are incompatible.
|
||||
Type '() => string' is not assignable to type '(s: string) => number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(49,7): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(66,47): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(72,5): error TS2322: Type 'number' is not assignable to type '() => string'.
|
||||
tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => number' is not assignable to type '() => any'.
|
||||
@@ -101,7 +101,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
||||
function of1(a: any) { return null; }
|
||||
|
||||
of1({ e: 0, f: 0 });
|
||||
~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'e' does not exist in type '{ c: { b: string; }; d: string; }'.
|
||||
|
||||
@@ -121,7 +121,7 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) =>
|
||||
}
|
||||
|
||||
var o1: { a: { a: string; }; b: string; } = { e: 0, f: 0 };
|
||||
~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'e' does not exist in type '{ a: { a: string; }; b: string; }'.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type '
|
||||
tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
|
||||
tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter.
|
||||
tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'.
|
||||
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/indexTypeCheck.ts (7 errors) ====
|
||||
@@ -72,7 +72,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
|
||||
|
||||
yellow[blue]; // error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
|
||||
var x:number[];
|
||||
x[0];
|
||||
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D<string>)[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D<string>[]', but here has type 'D<number>[]'.
|
||||
tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'.
|
||||
|
||||
@@ -79,7 +79,7 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'.
|
||||
var arr = [new C(), new C2(), new D<string>()];
|
||||
~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | C2 | D<string>)[]'.
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D<string>)[]'.
|
||||
|
||||
var arr2 = [new D<string>()];
|
||||
var arr2 = new Array<D<number>>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts(6,5): error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'.
|
||||
tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrExpressionIsContextuallyTyped.ts(6,33): error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'.
|
||||
Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'.
|
||||
Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.
|
||||
|
||||
@@ -10,7 +10,7 @@ tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrE
|
||||
// operand types.
|
||||
|
||||
var r: { a: string } = { a: '', b: 123 } || { a: '', b: true };
|
||||
~
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '{ a: string; b: number; } | { a: string; b: boolean; }' is not assignable to type '{ a: string; }'.
|
||||
!!! error TS2322: Type '{ a: string; b: number; }' is not assignable to type '{ a: string; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.
|
||||
@@ -187,8 +187,8 @@ var rc5 = a5 || a3; // void || number is void | number
|
||||
>a3 : number
|
||||
|
||||
var rc6 = a6 || a3; // enum || number is number
|
||||
>rc6 : E | number
|
||||
>a6 || a3 : E | number
|
||||
>rc6 : number
|
||||
>a6 || a3 : number
|
||||
>a6 : E
|
||||
>a3 : number
|
||||
|
||||
@@ -349,8 +349,8 @@ var rg2 = a2 || a6; // boolean || enum is boolean | enum
|
||||
>a6 : E
|
||||
|
||||
var rg3 = a3 || a6; // number || enum is number
|
||||
>rg3 : number | E
|
||||
>a3 || a6 : number | E
|
||||
>rg3 : number
|
||||
>a3 || a6 : number
|
||||
>a3 : number
|
||||
>a6 : E
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ function fn3<T extends { a: string; b: string }, U extends { a: string; b: numbe
|
||||
>u : U
|
||||
|
||||
var r3 = t || { a: '' };
|
||||
>r3 : T | { a: string; }
|
||||
>t || { a: '' } : T | { a: string; }
|
||||
>r3 : { a: string; }
|
||||
>t || { a: '' } : { a: string; }
|
||||
>t : T
|
||||
>{ a: '' } : { a: string; }
|
||||
>a : string
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/missingPropertiesOfClassExpression.ts(1,52): error TS2339: Property 'y' does not exist on type '(Anonymous class)'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/missingPropertiesOfClassExpression.ts (1 errors) ====
|
||||
class George extends class { reset() { return this.y; } } {
|
||||
~
|
||||
!!! error TS2339: Property 'y' does not exist on type '(Anonymous class)'.
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [missingPropertiesOfClassExpression.ts]
|
||||
class George extends class { reset() { return this.y; } } {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [missingPropertiesOfClassExpression.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 George = (function (_super) {
|
||||
__extends(George, _super);
|
||||
function George() {
|
||||
_super.call(this);
|
||||
}
|
||||
return George;
|
||||
})((function () {
|
||||
function class_1() {
|
||||
}
|
||||
class_1.prototype.reset = function () { return this.y; };
|
||||
return class_1;
|
||||
})());
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [tests/cases/compiler/nodeResolution1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
export var x = 1;
|
||||
|
||||
//// [b.ts]
|
||||
import y = require("./a");
|
||||
|
||||
//// [a.js]
|
||||
exports.x = 1;
|
||||
//// [b.js]
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import y = require("./a");
|
||||
>y : Symbol(y, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
export var x = 1;
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import y = require("./a");
|
||||
>y : typeof y
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
export var x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [tests/cases/compiler/nodeResolution2.ts] ////
|
||||
|
||||
//// [a.d.ts]
|
||||
|
||||
export var x: number;
|
||||
|
||||
//// [b.ts]
|
||||
import y = require("a");
|
||||
|
||||
//// [b.js]
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import y = require("a");
|
||||
>y : Symbol(y, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/node_modules/a.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : Symbol(x, Decl(a.d.ts, 1, 10))
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import y = require("a");
|
||||
>y : typeof y
|
||||
|
||||
=== tests/cases/compiler/node_modules/a.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : number
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [tests/cases/compiler/nodeResolution3.ts] ////
|
||||
|
||||
//// [index.d.ts]
|
||||
|
||||
export var x: number;
|
||||
|
||||
//// [a.ts]
|
||||
import y = require("b");
|
||||
|
||||
//// [a.js]
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import y = require("b");
|
||||
>y : Symbol(y, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/node_modules/b/index.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : Symbol(x, Decl(index.d.ts, 1, 10))
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import y = require("b");
|
||||
>y : typeof y
|
||||
|
||||
=== tests/cases/compiler/node_modules/b/index.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : number
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'A | B | number' is not assignable to type 'A'.
|
||||
Type 'A | number' is not assignable to type 'A'.
|
||||
Type 'number' is not assignable to type 'A'.
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
// error
|
||||
var b: { [x: number]: A } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: number]: A | B | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
!!! error TS2322: Type '{ [x: number]: A | number; 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'A | B | number' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'A | number' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'A'.
|
||||
1.0: new A(),
|
||||
2.0: new B(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS
|
||||
// ElementAccessExpressions can only contain one expression. There should be a parse error here.
|
||||
var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
|
||||
var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)];
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
|
||||
!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'?
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,5): error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'.
|
||||
tests/cases/compiler/objectLitStructuralTypeMismatch.ts(2,27): error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'.
|
||||
Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectLitStructuralTypeMismatch.ts (1 errors) ====
|
||||
// Shouldn't compile
|
||||
var x: { a: number; } = { b: 5 };
|
||||
~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ b: number; }' is not assignable to type '{ a: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'b' does not exist in type '{ a: number; }'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(8,6): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'.
|
||||
Object literal may only specify known properties, and 'hello' does not exist in type 'I'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(10,17): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'.
|
||||
Object literal may only specify known properties, and 'what' does not exist in type 'I'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(11,4): error TS2345: Argument of type '{ toString: (s: string) => string; }' is not assignable to parameter of type 'I'.
|
||||
Property 'value' is missing in type '{ toString: (s: string) => string; }'.
|
||||
@@ -18,12 +18,12 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping.ts(13,36): error T
|
||||
function f2(args: I) { }
|
||||
|
||||
f2({ hello: 1 }) // error
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'hello' does not exist in type 'I'.
|
||||
f2({ value: '' }) // missing toString satisfied by Object's member
|
||||
f2({ value: '', what: 1 }) // missing toString satisfied by Object's member
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'what' does not exist in type 'I'.
|
||||
f2({ toString: (s) => s }) // error, missing property value from ArgsString
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(8,4): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(8,6): error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'.
|
||||
Object literal may only specify known properties, and 'hello' does not exist in type 'I2'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(9,4): error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'.
|
||||
Property 'doStuff' is missing in type '{ value: string; }'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,4): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(10,17): error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'.
|
||||
Object literal may only specify known properties, and 'what' does not exist in type 'I2'.
|
||||
tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(11,4): error TS2345: Argument of type '{ toString: (s: any) => any; }' is not assignable to parameter of type 'I2'.
|
||||
Property 'value' is missing in type '{ toString: (s: any) => any; }'.
|
||||
@@ -21,7 +21,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T
|
||||
function f2(args: I2) { }
|
||||
|
||||
f2({ hello: 1 })
|
||||
~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ hello: number; }' is not assignable to parameter of type 'I2'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'hello' does not exist in type 'I2'.
|
||||
f2({ value: '' })
|
||||
@@ -29,7 +29,7 @@ tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts(13,4): error T
|
||||
!!! error TS2345: Argument of type '{ value: string; }' is not assignable to parameter of type 'I2'.
|
||||
!!! error TS2345: Property 'doStuff' is missing in type '{ value: string; }'.
|
||||
f2({ value: '', what: 1 })
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ value: string; what: number; }' is not assignable to parameter of type 'I2'.
|
||||
!!! error TS2345: Object literal may only specify known properties, and 'what' does not exist in type 'I2'.
|
||||
f2({ toString: (s) => s })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
|
||||
@@ -18,7 +18,7 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{
|
||||
|
||||
var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A
|
||||
~~
|
||||
!!! error TS2322: Type '{ [x: string]: B | A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Type '{ [x: string]: A; [x: number]: A; 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A
|
||||
@@ -31,7 +31,7 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i
|
||||
>A : A
|
||||
>n : number
|
||||
>B : B
|
||||
>{ x: a, 0: b } : { [x: string]: A | B; [x: number]: B; 0: B; x: A; }
|
||||
>{ x: a, 0: b } : { [x: string]: A; [x: number]: B; 0: B; x: A; }
|
||||
>x : A
|
||||
>a : A
|
||||
>b : B
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,16): error TS1131: Property or signature expected.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(5,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'id' must be of type 'number', but here has type 'any'.
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
var name: string = "my name";
|
||||
|
||||
var person: { b: string; id: number } = { name, id }; // error
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
var person1: { name, id }; // error: can't use short-hand property assignment in type position
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,5): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'.
|
||||
Types of property 'name' are incompatible.
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr
|
||||
var name: string = "my name";
|
||||
|
||||
var person: { b: string; id: number } = { name, id }; // error
|
||||
~~~~~~
|
||||
~~~~
|
||||
!!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'.
|
||||
function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user