mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-24 07:16:39 -05:00
Accepting new baselines
This commit is contained in:
@@ -6,6 +6,6 @@ function method() {
|
||||
>dictionary : { [index: string]: string; }
|
||||
><{ [index: string]: string; }>{} : { [index: string]: string; }
|
||||
>index : string
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]:
|
||||
>obj : { [s: string]: Contextual; }
|
||||
>s : string
|
||||
>Contextual : Contextual
|
||||
>{ s: e } : { [x: string]: Ellement; s: Ellement; }
|
||||
>{ s: e } : { s: Ellement; }
|
||||
>s : Ellement
|
||||
>e : Ellement
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ x2 += E.a;
|
||||
x2 += {};
|
||||
>x2 += {} : string
|
||||
>x2 : string
|
||||
>{} : { [x: number]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
x2 += null;
|
||||
>x2 += null : string
|
||||
|
||||
@@ -35,7 +35,7 @@ var o: {
|
||||
>idx : number
|
||||
|
||||
} = {
|
||||
>{ 1: true } : { [x: number]: boolean; 1: boolean; }
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
|
||||
15
tests/baselines/reference/contextualTypeAny.errors.txt
Normal file
15
tests/baselines/reference/contextualTypeAny.errors.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
tests/cases/compiler/contextualTypeAny.ts(3,5): error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
|
||||
Property 'p' is incompatible with index signature.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTypeAny.ts (1 errors) ====
|
||||
var x: any;
|
||||
|
||||
var obj: { [s: string]: number } = { p: "", q: x };
|
||||
~~~
|
||||
!!! error TS2322: Type '{ p: string; q: any; }' is not assignable to type '{ [s: string]: number; }'.
|
||||
!!! error TS2322: Property 'p' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
var arr: number[] = ["", x];
|
||||
@@ -1,15 +0,0 @@
|
||||
=== tests/cases/compiler/contextualTypeAny.ts ===
|
||||
var x: any;
|
||||
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
|
||||
|
||||
var obj: { [s: string]: number } = { p: "", q: x };
|
||||
>obj : Symbol(obj, Decl(contextualTypeAny.ts, 2, 3))
|
||||
>s : Symbol(s, Decl(contextualTypeAny.ts, 2, 12))
|
||||
>p : Symbol(p, Decl(contextualTypeAny.ts, 2, 36))
|
||||
>q : Symbol(q, Decl(contextualTypeAny.ts, 2, 43))
|
||||
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
|
||||
|
||||
var arr: number[] = ["", x];
|
||||
>arr : Symbol(arr, Decl(contextualTypeAny.ts, 4, 3))
|
||||
>x : Symbol(x, Decl(contextualTypeAny.ts, 0, 3))
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
=== tests/cases/compiler/contextualTypeAny.ts ===
|
||||
var x: any;
|
||||
>x : any
|
||||
|
||||
var obj: { [s: string]: number } = { p: "", q: x };
|
||||
>obj : { [s: string]: number; }
|
||||
>s : string
|
||||
>{ p: "", q: x } : { [x: string]: any; p: string; q: any; }
|
||||
>p : string
|
||||
>"" : string
|
||||
>q : any
|
||||
>x : any
|
||||
|
||||
var arr: number[] = ["", x];
|
||||
>arr : number[]
|
||||
>["", x] : any[]
|
||||
>"" : string
|
||||
>x : any
|
||||
|
||||
@@ -26,18 +26,18 @@ interface Transform3D {
|
||||
var style: IBookStyle = {
|
||||
>style : IBookStyle
|
||||
>IBookStyle : IBookStyle
|
||||
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { [x: string]: any; 'ry': any; }[]; }
|
||||
>{ initialLeftPageTransforms: (width: number) => { return [ {'ry': null } ]; }} : { initialLeftPageTransforms: (width: number) => { 'ry': any; }[]; }
|
||||
|
||||
initialLeftPageTransforms: (width: number) => {
|
||||
>initialLeftPageTransforms : (width: number) => { [x: string]: any; 'ry': any; }[]
|
||||
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { [x: string]: any; 'ry': any; }[]
|
||||
>initialLeftPageTransforms : (width: number) => { 'ry': any; }[]
|
||||
>(width: number) => { return [ {'ry': null } ]; } : (width: number) => { 'ry': any; }[]
|
||||
>width : number
|
||||
|
||||
return [
|
||||
>[ {'ry': null } ] : { [x: string]: null; 'ry': null; }[]
|
||||
>[ {'ry': null } ] : { 'ry': null; }[]
|
||||
|
||||
{'ry': null }
|
||||
>{'ry': null } : { [x: string]: null; 'ry': null; }
|
||||
>{'ry': null } : { 'ry': null; }
|
||||
>null : null
|
||||
|
||||
];
|
||||
|
||||
@@ -69,7 +69,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { z: a => a };
|
||||
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
|
||||
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
|
||||
>IWithStringIndexSignature1 : IWithStringIndexSignature1
|
||||
>{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; }
|
||||
>{ z: a => a } : { z: (a: number) => number; }
|
||||
>z : (a: number) => number
|
||||
>a => a : (a: number) => number
|
||||
>a : number
|
||||
@@ -79,7 +79,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: a => a
|
||||
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
|
||||
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
|
||||
>IWithStringIndexSignature1 : IWithStringIndexSignature1
|
||||
>{ foo: a => a } : { [x: string]: (a: any) => any; foo: (a: any) => any; }
|
||||
>{ foo: a => a } : { foo: (a: any) => any; }
|
||||
>foo : (a: any) => any
|
||||
>a => a : (a: any) => any
|
||||
>a : any
|
||||
@@ -89,7 +89,7 @@ var x: IWithNoStringIndexSignature | IWithStringIndexSignature1 = { foo: "hello"
|
||||
>x : IWithNoStringIndexSignature | IWithStringIndexSignature1
|
||||
>IWithNoStringIndexSignature : IWithNoStringIndexSignature
|
||||
>IWithStringIndexSignature1 : IWithStringIndexSignature1
|
||||
>{ foo: "hello" } : { [x: string]: string; foo: string; }
|
||||
>{ foo: "hello" } : { foo: string; }
|
||||
>foo : string
|
||||
>"hello" : string
|
||||
|
||||
@@ -97,7 +97,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a.to
|
||||
>x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2
|
||||
>IWithStringIndexSignature1 : IWithStringIndexSignature1
|
||||
>IWithStringIndexSignature2 : IWithStringIndexSignature2
|
||||
>{ z: a => a.toString() } : { [x: string]: (a: number) => string; z: (a: number) => string; }
|
||||
>{ z: a => a.toString() } : { z: (a: number) => string; }
|
||||
>z : (a: number) => string
|
||||
>a => a.toString() : (a: number) => string
|
||||
>a : number
|
||||
@@ -110,7 +110,7 @@ var x2: IWithStringIndexSignature1 | IWithStringIndexSignature2 = { z: a => a };
|
||||
>x2 : IWithStringIndexSignature1 | IWithStringIndexSignature2
|
||||
>IWithStringIndexSignature1 : IWithStringIndexSignature1
|
||||
>IWithStringIndexSignature2 : IWithStringIndexSignature2
|
||||
>{ z: a => a } : { [x: string]: (a: number) => number; z: (a: number) => number; }
|
||||
>{ z: a => a } : { z: (a: number) => number; }
|
||||
>z : (a: number) => number
|
||||
>a => a : (a: number) => number
|
||||
>a : number
|
||||
@@ -124,7 +124,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 1: a => a }
|
||||
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
|
||||
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
|
||||
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
|
||||
>{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; }
|
||||
>{ 1: a => a } : { 1: (a: number) => number; }
|
||||
>a => a : (a: number) => number
|
||||
>a : number
|
||||
>a : number
|
||||
@@ -133,7 +133,7 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: a => a }
|
||||
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
|
||||
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
|
||||
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
|
||||
>{ 0: a => a } : { [x: number]: (a: any) => any; 0: (a: any) => any; }
|
||||
>{ 0: a => a } : { 0: (a: any) => any; }
|
||||
>a => a : (a: any) => any
|
||||
>a : any
|
||||
>a : any
|
||||
@@ -142,14 +142,14 @@ var x3: IWithNoNumberIndexSignature | IWithNumberIndexSignature1 = { 0: "hello"
|
||||
>x3 : IWithNoNumberIndexSignature | IWithNumberIndexSignature1
|
||||
>IWithNoNumberIndexSignature : IWithNoNumberIndexSignature
|
||||
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
|
||||
>{ 0: "hello" } : { [x: number]: string; 0: string; }
|
||||
>{ 0: "hello" } : { 0: string; }
|
||||
>"hello" : string
|
||||
|
||||
var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a.toString() }; // a should be number
|
||||
>x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2
|
||||
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
|
||||
>IWithNumberIndexSignature2 : IWithNumberIndexSignature2
|
||||
>{ 1: a => a.toString() } : { [x: number]: (a: number) => string; 1: (a: number) => string; }
|
||||
>{ 1: a => a.toString() } : { 1: (a: number) => string; }
|
||||
>a => a.toString() : (a: number) => string
|
||||
>a : number
|
||||
>a.toString() : string
|
||||
@@ -161,7 +161,7 @@ var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a };
|
||||
>x4 : IWithNumberIndexSignature1 | IWithNumberIndexSignature2
|
||||
>IWithNumberIndexSignature1 : IWithNumberIndexSignature1
|
||||
>IWithNumberIndexSignature2 : IWithNumberIndexSignature2
|
||||
>{ 1: a => a } : { [x: number]: (a: number) => number; 1: (a: number) => number; }
|
||||
>{ 1: a => a } : { 1: (a: number) => number; }
|
||||
>a => a : (a: number) => number
|
||||
>a : number
|
||||
>a : number
|
||||
|
||||
@@ -10,9 +10,9 @@ var obj2 = {x: ""};
|
||||
>"" : string
|
||||
|
||||
obj1 = {}; // Ok
|
||||
>obj1 = {} : { [x: string]: undefined; }
|
||||
>obj1 = {} : {}
|
||||
>obj1 : { [x: string]: string; }
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
obj1 = obj2; // Error - indexer doesn't match
|
||||
>obj1 = obj2 : { x: string; }
|
||||
@@ -27,7 +27,7 @@ function f(x: { [s: string]: string }) { }
|
||||
f({}); // Ok
|
||||
>f({}) : void
|
||||
>f : (x: { [s: string]: string; }) => void
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
f(obj1); // Ok
|
||||
>f(obj1) : void
|
||||
|
||||
@@ -11,8 +11,8 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13):
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{}' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ 0: number; 1: number; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
|
||||
tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(74,11): error TS2459: Type 'undefined[]' has no property 'a' and no string index signature.
|
||||
@@ -122,10 +122,10 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9):
|
||||
function f9() {
|
||||
var [a, b] = {}; // Error, not array type
|
||||
~~~~~~
|
||||
!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
|
||||
!!! error TS2461: Type '{}' is not an array type.
|
||||
var [c, d] = { 0: 10, 1: 20 }; // Error, not array type
|
||||
~~~~~~
|
||||
!!! error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type.
|
||||
!!! error TS2461: Type '{ 0: number; 1: number; }' is not an array type.
|
||||
var [e, f] = [10, 20];
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ function foo(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 1: true } : { [x: number]: boolean; 1: boolean; }
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
@@ -82,7 +82,7 @@ function bar(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 2: true } : { [x: number]: boolean; 2: boolean; }
|
||||
>{ 2: true } : { 2: boolean; }
|
||||
|
||||
2: true
|
||||
>true : boolean
|
||||
@@ -114,7 +114,7 @@ function foo1(): F1 {
|
||||
>F1 : F1
|
||||
|
||||
return {
|
||||
>{ "prop1": 2 } : { [x: string]: number; "prop1": number; }
|
||||
>{ "prop1": 2 } : { "prop1": number; }
|
||||
|
||||
"prop1": 2
|
||||
>2 : number
|
||||
|
||||
@@ -69,7 +69,7 @@ function foo(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 1: true } : { [x: number]: boolean; 1: boolean; }
|
||||
>{ 1: true } : { 1: boolean; }
|
||||
|
||||
1: true
|
||||
>true : boolean
|
||||
@@ -82,7 +82,7 @@ function bar(): F {
|
||||
>F : F
|
||||
|
||||
return {
|
||||
>{ 2: true } : { [x: number]: boolean; 2: boolean; }
|
||||
>{ 2: true } : { 2: boolean; }
|
||||
|
||||
2: true
|
||||
>true : boolean
|
||||
@@ -114,7 +114,7 @@ function foo1(): F1 {
|
||||
>F1 : F1
|
||||
|
||||
return {
|
||||
>{ "prop1": 2 } : { [x: string]: number; "prop1": number; }
|
||||
>{ "prop1": 2 } : { "prop1": number; }
|
||||
|
||||
"prop1": 2
|
||||
>2 : number
|
||||
|
||||
@@ -26,7 +26,7 @@ var moduleMap: { [key: string]: IHasVisualizationModel } = {
|
||||
>moduleMap : { [key: string]: IHasVisualizationModel; }
|
||||
>key : string
|
||||
>IHasVisualizationModel : IHasVisualizationModel
|
||||
>{ "moduleA": moduleA, "moduleB": moduleB} : { [x: string]: typeof moduleA; "moduleA": typeof moduleA; "moduleB": typeof moduleB; }
|
||||
>{ "moduleA": moduleA, "moduleB": moduleB} : { "moduleA": typeof moduleA; "moduleB": typeof moduleB; }
|
||||
|
||||
"moduleA": moduleA,
|
||||
>moduleA : typeof moduleA
|
||||
|
||||
@@ -14,11 +14,11 @@ class BaseCollection2<TItem extends CollectionItem2> {
|
||||
|
||||
constructor() {
|
||||
this._itemsByKey = {};
|
||||
>this._itemsByKey = {} : { [x: string]: undefined; }
|
||||
>this._itemsByKey = {} : {}
|
||||
>this._itemsByKey : { [key: string]: TItem; }
|
||||
>this : this
|
||||
>_itemsByKey : { [key: string]: TItem; }
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,1): error TS2322: Type '[number, string]' is not assignable to type '[string, number]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{ [x: number]: undefined; }, {}]' is not assignable to type '[string, number]'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,1): error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type '{ [x: number]: undefined; }' is not assignable to type 'string'.
|
||||
Type '{}' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
|
||||
Property '1' is missing in type '[{}]'.
|
||||
|
||||
@@ -55,9 +55,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTup
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
i1.tuple1 = [{}, {}];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[{ [x: number]: undefined; }, {}]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Type '[{}, {}]' is not assignable to type '[string, number]'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type '{ [x: number]: undefined; }' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'string'.
|
||||
i2.tuple1 = [{}];
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type '[{}]' is not assignable to type '[{}, {}]'.
|
||||
|
||||
@@ -8,7 +8,7 @@ class LazyArray<T> {
|
||||
><{ [objectId: string]: T; }>{} : { [objectId: string]: T; }
|
||||
>objectId : string
|
||||
>T : T
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
array() {
|
||||
>array : () => { [objectId: string]: T; }
|
||||
|
||||
@@ -21,15 +21,15 @@ var x1 = foo({ 0: 0, 1: 1 }); // type should be number
|
||||
>x1 : number
|
||||
>foo({ 0: 0, 1: 1 }) : number
|
||||
>foo : <T>(items: { [index: number]: T; }) => T
|
||||
>{ 0: 0, 1: 1 } : { [x: number]: number; 0: number; 1: number; }
|
||||
>{ 0: 0, 1: 1 } : { 0: number; 1: number; }
|
||||
>0 : number
|
||||
>1 : number
|
||||
|
||||
var x2 = foo({ zero: 0, one: 1 });
|
||||
>x2 : any
|
||||
>foo({ zero: 0, one: 1 }) : any
|
||||
>x2 : {}
|
||||
>foo({ zero: 0, one: 1 }) : {}
|
||||
>foo : <T>(items: { [index: number]: T; }) => T
|
||||
>{ zero: 0, one: 1 } : { [x: number]: undefined; zero: number; one: number; }
|
||||
>{ zero: 0, one: 1 } : { zero: number; one: number; }
|
||||
>zero : number
|
||||
>0 : number
|
||||
>one : number
|
||||
@@ -39,7 +39,7 @@ var x3 = bar({ 0: 0, 1: 1 });
|
||||
>x3 : number
|
||||
>bar({ 0: 0, 1: 1 }) : number
|
||||
>bar : <T>(items: { [index: string]: T; }) => T
|
||||
>{ 0: 0, 1: 1 } : { [x: string]: number; 0: number; 1: number; }
|
||||
>{ 0: 0, 1: 1 } : { 0: number; 1: number; }
|
||||
>0 : number
|
||||
>1 : number
|
||||
|
||||
@@ -47,7 +47,7 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number
|
||||
>x4 : number
|
||||
>bar({ zero: 0, one: 1 }) : number
|
||||
>bar : <T>(items: { [index: string]: T; }) => T
|
||||
>{ zero: 0, one: 1 } : { [x: string]: number; zero: number; one: number; }
|
||||
>{ zero: 0, one: 1 } : { zero: number; one: number; }
|
||||
>zero : number
|
||||
>0 : number
|
||||
>one : number
|
||||
|
||||
@@ -17,7 +17,7 @@ interface JQuery {
|
||||
var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } };
|
||||
>jq : JQuery
|
||||
>JQuery : JQuery
|
||||
>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; }
|
||||
>{ 0: { id : "a" }, 1: { id : "b" } } : { 0: { id: string; }; 1: { id: string; }; }
|
||||
>{ id : "a" } : { id: string; }
|
||||
>id : string
|
||||
>"a" : string
|
||||
|
||||
@@ -17,5 +17,5 @@ var directChildrenMap = <IDirectChildrenMap>{};
|
||||
>directChildrenMap : IDirectChildrenMap
|
||||
><IDirectChildrenMap>{} : IDirectChildrenMap
|
||||
>IDirectChildrenMap : IDirectChildrenMap
|
||||
>{} : { [x: number]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ var dateMap: { [x: string]: Date; } = {}
|
||||
>dateMap : { [x: string]: Date; }
|
||||
>x : string
|
||||
>Date : Date
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
var r: Date = dateMap["hello"] // result type includes indexer using BCT
|
||||
>r : Date
|
||||
|
||||
@@ -17,7 +17,7 @@ class JQuery {
|
||||
var jq:JQuery={ 0: { id : "a" }, 1: { id : "b" } };
|
||||
>jq : JQuery
|
||||
>JQuery : JQuery
|
||||
>{ 0: { id : "a" }, 1: { id : "b" } } : { [x: number]: { id: string; }; 0: { id: string; }; 1: { id: string; }; }
|
||||
>{ 0: { id : "a" }, 1: { id : "b" } } : { 0: { id: string; }; 1: { id: string; }; }
|
||||
>{ id : "a" } : { id: string; }
|
||||
>id : string
|
||||
>"a" : string
|
||||
|
||||
@@ -30,13 +30,13 @@ foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } }
|
||||
>foo("", { method(p1) { return p1.length } }, { method(p2) { return undefined } }) : string
|
||||
>foo : <T, U>(x: T, y: Int<T, U>, z: Int<U, T>) => T
|
||||
>"" : string
|
||||
>{ method(p1) { return p1.length } } : { [x: string]: (p1: string) => number; method(p1: string): number; }
|
||||
>{ method(p1) { return p1.length } } : { method(p1: string): number; }
|
||||
>method : (p1: string) => number
|
||||
>p1 : string
|
||||
>p1.length : number
|
||||
>p1 : string
|
||||
>length : number
|
||||
>{ method(p2) { return undefined } } : { [x: string]: (p2: number) => any; method(p2: number): any; }
|
||||
>{ method(p2) { return undefined } } : { method(p2: number): any; }
|
||||
>method : (p2: number) => any
|
||||
>p2 : number
|
||||
>undefined : undefined
|
||||
|
||||
@@ -49,10 +49,10 @@ class ObjectField<A, T extends { [name: string]: Field<any> }> {
|
||||
}
|
||||
|
||||
var person = new ObjectField({
|
||||
>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }>
|
||||
>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }>
|
||||
>person : ObjectField<{}, { id: NumberField; name: CharField; }>
|
||||
>new ObjectField({ id: new NumberField(), name: new CharField()}) : ObjectField<{}, { id: NumberField; name: CharField; }>
|
||||
>ObjectField : typeof ObjectField
|
||||
>{ id: new NumberField(), name: new CharField()} : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }
|
||||
>{ id: new NumberField(), name: new CharField()} : { id: NumberField; name: CharField; }
|
||||
|
||||
id: new NumberField(),
|
||||
>id : NumberField
|
||||
@@ -68,8 +68,8 @@ var person = new ObjectField({
|
||||
|
||||
person.fields.id;
|
||||
>person.fields.id : NumberField
|
||||
>person.fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }
|
||||
>person : ObjectField<{}, { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }>
|
||||
>fields : { [x: string]: NumberField | CharField; id: NumberField; name: CharField; }
|
||||
>person.fields : { id: NumberField; name: CharField; }
|
||||
>person : ObjectField<{}, { id: NumberField; name: CharField; }>
|
||||
>fields : { id: NumberField; name: CharField; }
|
||||
>id : NumberField
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ class Bug {
|
||||
>ok : () => void
|
||||
|
||||
this.values = {};
|
||||
>this.values = {} : { [x: string]: undefined; }
|
||||
>this.values = {} : {}
|
||||
>this.values : IMap
|
||||
>this : this
|
||||
>values : IMap
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
this.values['comments'] = { italic: true };
|
||||
>this.values['comments'] = { italic: true } : { italic: boolean; }
|
||||
@@ -48,11 +48,11 @@ class Bug {
|
||||
>shouldBeOK : () => void
|
||||
|
||||
this.values = {
|
||||
>this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
|
||||
>this.values = { comments: { italic: true } } : { comments: { italic: boolean; }; }
|
||||
>this.values : IMap
|
||||
>this : this
|
||||
>values : IMap
|
||||
>{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
|
||||
>{ comments: { italic: true } } : { comments: { italic: boolean; }; }
|
||||
|
||||
comments: { italic: true }
|
||||
>comments : { italic: boolean; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/noErrorsInCallback.ts(4,19): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/noErrorsInCallback.ts(4,19): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/noErrorsInCallback.ts (2 errors) ====
|
||||
@@ -8,10 +8,10 @@ tests/cases/compiler/noErrorsInCallback.ts(6,23): error TS2345: Argument of type
|
||||
}
|
||||
var one = new Bar({}); // Error
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
[].forEach(() => {
|
||||
var two = new Bar({}); // No error?
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'string'.
|
||||
});
|
||||
|
||||
@@ -87,7 +87,7 @@ interface MyMap<T> {
|
||||
var m: MyMap<number> = {
|
||||
>m : MyMap<number>
|
||||
>MyMap : MyMap<T>
|
||||
>{ "0": 0, "1": 1, "2": 2, "Okay that's enough for today.": NaN} : { [x: string]: number; "0": number; "1": number; "2": number; "Okay that's enough for today.": number; }
|
||||
>{ "0": 0, "1": 1, "2": 2, "Okay that's enough for today.": NaN} : { "0": number; "1": number; "2": number; "Okay that's enough for today.": number; }
|
||||
|
||||
"0": 0,
|
||||
>0 : number
|
||||
|
||||
@@ -5,10 +5,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
Property '2.0' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
@@ -108,10 +107,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
// error
|
||||
var b: { [x: number]: string; } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
|
||||
!!! error TS2322: Property '2.0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a: '',
|
||||
b: 1,
|
||||
c: () => { },
|
||||
|
||||
@@ -1,10 +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 | 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 | number' is not assignable to type 'A'.
|
||||
Type 'number' is not assignable to type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(39,5): error TS2322: Type '{ 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'.
|
||||
Property '3.0' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts (4 errors) ====
|
||||
@@ -54,10 +53,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
|
||||
// error
|
||||
var b: { [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 | number' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'A'.
|
||||
!!! error TS2322: Type '{ 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: Property '3.0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'A'.
|
||||
1.0: new A(),
|
||||
2.0: new B(),
|
||||
"2.5": new B(),
|
||||
|
||||
@@ -22,7 +22,7 @@ var x: {
|
||||
>A : A
|
||||
|
||||
} = { data: new B() }
|
||||
>{ data: new B() } : { [x: number]: undefined; data: B; }
|
||||
>{ data: new B() } : { data: B; }
|
||||
>data : B
|
||||
>new B() : B
|
||||
>B : typeof B
|
||||
|
||||
@@ -151,7 +151,7 @@ var r6 = a[3];
|
||||
var b: { [x: number]: string } = { 1: '', "2": '' }
|
||||
>b : { [x: number]: string; }
|
||||
>x : number
|
||||
>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; }
|
||||
>{ 1: '', "2": '' } : { 1: string; "2": string; }
|
||||
>'' : string
|
||||
>'' : string
|
||||
|
||||
@@ -194,7 +194,7 @@ var r6 = b[3];
|
||||
var b2: { [x: number]: string; 1: string; "2": string; } = { 1: '', "2": '' }
|
||||
>b2 : { [x: number]: string; 1: string; "2": string; }
|
||||
>x : number
|
||||
>{ 1: '', "2": '' } : { [x: number]: string; 1: string; "2": string; }
|
||||
>{ 1: '', "2": '' } : { 1: string; "2": string; }
|
||||
>'' : string
|
||||
>'' : string
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ class Emitter {
|
||||
|
||||
constructor () {
|
||||
this.listeners = {};
|
||||
>this.listeners = {} : { [x: string]: undefined; }
|
||||
>this.listeners = {} : {}
|
||||
>this.listeners : IMap
|
||||
>this : this
|
||||
>listeners : IMap
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
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.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
Property '0' is incompatible with index signature.
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
Property 'y' is missing in type 'A'.
|
||||
tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
Property '0' is incompatible with index signature.
|
||||
Type 'A' is not assignable to type 'B'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/objectLiteralIndexerErrors.ts (1 errors) ====
|
||||
==== tests/cases/compiler/objectLiteralIndexerErrors.ts (2 errors) ====
|
||||
interface A {
|
||||
x: number;
|
||||
}
|
||||
@@ -19,8 +22,12 @@ 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]: 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 '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Property '0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
!!! error TS2322: Property 'y' is missing in type 'A'.
|
||||
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A
|
||||
o1 = { x: c, 0: a }; // string indexer is any, number indexer is A
|
||||
~~
|
||||
!!! error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'.
|
||||
!!! error TS2322: Property '0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
||||
@@ -9,7 +9,7 @@ interface I {
|
||||
var x: I = {
|
||||
>x : I
|
||||
>I : I
|
||||
>{ p: null} : { [x: string]: null; p: null; }
|
||||
>{ p: null} : { p: null; }
|
||||
|
||||
p: null
|
||||
>p : null
|
||||
|
||||
@@ -31,23 +31,23 @@ 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; [x: number]: B; 0: B; x: A; }
|
||||
>{ x: a, 0: b } : { 0: B; x: A; }
|
||||
>x : A
|
||||
>a : A
|
||||
>b : B
|
||||
|
||||
o1 = { x: b, 0: c }; // both indexers are any
|
||||
>o1 = { x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; }
|
||||
>o1 = { x: b, 0: c } : { 0: any; x: B; }
|
||||
>o1 : { [s: string]: A; [n: number]: B; }
|
||||
>{ x: b, 0: c } : { [x: string]: any; [x: number]: any; 0: any; x: B; }
|
||||
>{ x: b, 0: c } : { 0: any; x: B; }
|
||||
>x : B
|
||||
>b : B
|
||||
>c : any
|
||||
|
||||
o1 = { x: c, 0: b }; // string indexer is any, number indexer is B
|
||||
>o1 = { x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; }
|
||||
>o1 = { x: c, 0: b } : { 0: B; x: any; }
|
||||
>o1 : { [s: string]: A; [n: number]: B; }
|
||||
>{ x: c, 0: b } : { [x: string]: any; [x: number]: B; 0: B; x: any; }
|
||||
>{ x: c, 0: b } : { 0: B; x: any; }
|
||||
>x : any
|
||||
>c : any
|
||||
>b : B
|
||||
|
||||
@@ -50,7 +50,7 @@ var a: {
|
||||
var b: { [x: number]: string; } = { foo: '' };
|
||||
>b : { [x: number]: string; }
|
||||
>x : number
|
||||
>{ foo: '' } : { [x: number]: undefined; foo: string; }
|
||||
>{ foo: '' } : { foo: string; }
|
||||
>foo : string
|
||||
>'' : string
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ var b: { [x: number]: Derived; } = { foo: <Derived>null };
|
||||
>b : { [x: number]: Derived; }
|
||||
>x : number
|
||||
>Derived : Derived
|
||||
>{ foo: <Derived>null } : { [x: number]: undefined; foo: Derived; }
|
||||
>{ foo: <Derived>null } : { foo: Derived; }
|
||||
>foo : Derived
|
||||
><Derived>null : Derived
|
||||
>Derived : Derived
|
||||
|
||||
@@ -50,7 +50,7 @@ var a: {
|
||||
var b: { [x: number]: string; } = { foo: '' };
|
||||
>b : { [x: number]: string; }
|
||||
>x : number
|
||||
>{ foo: '' } : { [x: number]: undefined; foo: string; }
|
||||
>{ foo: '' } : { foo: string; }
|
||||
>foo : string
|
||||
>'' : string
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ var a: {
|
||||
var b: { [x: string]: string; } = { foo: '' };
|
||||
>b : { [x: string]: string; }
|
||||
>x : string
|
||||
>{ foo: '' } : { [x: string]: string; foo: string; }
|
||||
>{ foo: '' } : { foo: string; }
|
||||
>foo : string
|
||||
>'' : string
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ var b: { [x: string]: Derived; } = { foo: <Derived>null };
|
||||
>b : { [x: string]: Derived; }
|
||||
>x : string
|
||||
>Derived : Derived
|
||||
>{ foo: <Derived>null } : { [x: string]: Derived; foo: Derived; }
|
||||
>{ foo: <Derived>null } : { foo: Derived; }
|
||||
>foo : Derived
|
||||
><Derived>null : Derived
|
||||
>Derived : Derived
|
||||
|
||||
@@ -28,7 +28,7 @@ function createSerialNo() {
|
||||
let map1: { [x: string]: number } = {};
|
||||
>map1 : { [x: string]: number; }
|
||||
>x : string
|
||||
>{} : { [x: string]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
let guid = createGuid();
|
||||
>guid : string & { $Guid: any; }
|
||||
@@ -45,7 +45,7 @@ map1[guid] = 123; // Can with tagged string
|
||||
let map2: { [x: number]: string } = {};
|
||||
>map2 : { [x: number]: string; }
|
||||
>x : number
|
||||
>{} : { [x: number]: undefined; }
|
||||
>{} : {}
|
||||
|
||||
let serialNo = createSerialNo();
|
||||
>serialNo : number & { $SerialNo: any; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
|
||||
tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{}' is not an array type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ====
|
||||
@@ -16,7 +16,7 @@ tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15
|
||||
|
||||
function foo3([...r] = {}) {
|
||||
~~~~~~
|
||||
!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type.
|
||||
!!! error TS2461: Type '{}' is not an array type.
|
||||
}
|
||||
|
||||
function foo4([...r] = []) {
|
||||
|
||||
@@ -22,10 +22,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Index signatures are incompatible.
|
||||
Type 'string | number | (() => void) | MyString' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Property '2.0' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -158,10 +157,9 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
// error
|
||||
var b: { [x: string]: string; } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: string]: string | number | (() => void) | MyString; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'string | number | (() => void) | MyString' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Property '2.0' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
a: '',
|
||||
b: 1,
|
||||
c: () => { },
|
||||
|
||||
@@ -4,8 +4,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(24,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(31,5): error TS2411: Property 'c' of type 'number' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(32,5): error TS2411: Property 'd' of type 'string' is not assignable to string index type 'A'.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
Index signatures are incompatible.
|
||||
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations2.ts(36,5): error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
Property 'a' is incompatible with index signature.
|
||||
Type 'typeof A' is not assignable to type 'A'.
|
||||
Property 'foo' is missing in type 'typeof A'.
|
||||
|
||||
@@ -60,8 +60,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
|
||||
// error
|
||||
var b: { [x: string]: A } = {
|
||||
~
|
||||
!!! error TS2322: Type '{ [x: string]: typeof A; a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type '{ a: typeof A; b: typeof B; }' is not assignable to type '{ [x: string]: A; }'.
|
||||
!!! error TS2322: Property 'a' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'typeof A' is not assignable to type 'A'.
|
||||
!!! error TS2322: Property 'foo' is missing in type 'typeof A'.
|
||||
a: A,
|
||||
|
||||
@@ -95,7 +95,7 @@ var r9 = a[1];
|
||||
var b: { [x: string]: string } = { y: '' }
|
||||
>b : { [x: string]: string; }
|
||||
>x : string
|
||||
>{ y: '' } : { [x: string]: string; y: string; }
|
||||
>{ y: '' } : { y: string; }
|
||||
>y : string
|
||||
>'' : string
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (1 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2
|
||||
|
||||
f({}, 10, 10);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{}'.
|
||||
|
||||
f `abcdef${ 1234 }${ 5678 }ghijkl`;
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts (1 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/compiler/templateStringsArrayTypeNotDefinedES5Mode.ts(5,3): error TS
|
||||
|
||||
f({}, 10, 10);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{}'.
|
||||
|
||||
f `abcdef${ 1234 }${ 5678 }ghijkl`;
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
Property 'raw' is missing in type '{}'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts (1 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error T
|
||||
|
||||
f({}, 10, 10);
|
||||
~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; }' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{ [x: number]: undefined; }'.
|
||||
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
|
||||
!!! error TS2345: Property 'raw' is missing in type '{}'.
|
||||
|
||||
f `abcdef${ 1234 }${ 5678 }ghijkl`;
|
||||
@@ -31,17 +31,17 @@ var foo: IFoo;
|
||||
>IFoo : IFoo
|
||||
|
||||
foo.foo({ bar: null }, bar => null, bar => null);
|
||||
>foo.foo({ bar: null }, bar => null, bar => null) : { [x: string]: any; bar: any; }
|
||||
>foo.foo({ bar: null }, bar => null, bar => null) : { bar: any; }
|
||||
>foo.foo : <TBar extends IBar>(bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar
|
||||
>foo : IFoo
|
||||
>foo : <TBar extends IBar>(bar: TBar, bar1: (bar: TBar) => TBar, bar2: (bar: TBar) => TBar) => TBar
|
||||
>{ bar: null } : { [x: string]: null; bar: null; }
|
||||
>{ bar: null } : { bar: null; }
|
||||
>bar : null
|
||||
>null : null
|
||||
>bar => null : (bar: { [x: string]: any; bar: any; }) => any
|
||||
>bar : { [x: string]: any; bar: any; }
|
||||
>bar => null : (bar: { bar: any; }) => any
|
||||
>bar : { bar: any; }
|
||||
>null : null
|
||||
>bar => null : (bar: { [x: string]: any; bar: any; }) => any
|
||||
>bar : { [x: string]: any; bar: any; }
|
||||
>bar => null : (bar: { bar: any; }) => any
|
||||
>bar : { bar: any; }
|
||||
>null : null
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ _.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(valu
|
||||
>_.each : { <T>(list: T[], iterator: Iterator<T, void>, context?: any): void; <T>(list: Dictionary<T>, iterator: Iterator<T, void>, context?: any): void; }
|
||||
>_ : Underscore.Static
|
||||
>each : { <T>(list: T[], iterator: Iterator<T, void>, context?: any): void; <T>(list: Dictionary<T>, iterator: Iterator<T, void>, context?: any): void; }
|
||||
>{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; }
|
||||
>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; }
|
||||
>one : number
|
||||
>1 : number
|
||||
>two : number
|
||||
@@ -68,7 +68,7 @@ _.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3);
|
||||
>_.map : { <T, U>(list: T[], iterator: Iterator<T, U>, context?: any): U[]; <T, U>(list: Dictionary<T>, iterator: Iterator<T, U>, context?: any): U[]; }
|
||||
>_ : Underscore.Static
|
||||
>map : { <T, U>(list: T[], iterator: Iterator<T, U>, context?: any): U[]; <T, U>(list: Dictionary<T>, iterator: Iterator<T, U>, context?: any): U[]; }
|
||||
>{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; }
|
||||
>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; }
|
||||
>one : number
|
||||
>1 : number
|
||||
>two : number
|
||||
@@ -449,7 +449,7 @@ _.size({ one: 1, two: 2, three: 3 });
|
||||
>_.size : { <T>(list: T[]): number; <T>(list: Dictionary<T>): number; }
|
||||
>_ : Underscore.Static
|
||||
>size : { <T>(list: T[]): number; <T>(list: Dictionary<T>): number; }
|
||||
>{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; }
|
||||
>{ one: 1, two: 2, three: 3 } : { one: number; two: number; three: number; }
|
||||
>one : number
|
||||
>1 : number
|
||||
>two : number
|
||||
|
||||
@@ -6,8 +6,8 @@ tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not a
|
||||
tests/cases/compiler/widenedTypes.ts(18,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/widenedTypes.ts(23,5): error TS2322: Type 'number[]' is not assignable to type 'string[]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: number; x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Index signatures are incompatible.
|
||||
tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
Property 'x' is incompatible with index signature.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -52,6 +52,6 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
var obj: { [x: string]: string; } = { x: 3, y: null }; // assignable because null is widened, and therefore BCT is any
|
||||
~~~
|
||||
!!! error TS2322: Type '{ [x: string]: number; x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type '{ x: number; y: null; }' is not assignable to type '{ [x: string]: string; }'.
|
||||
!!! error TS2322: Property 'x' is incompatible with index signature.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts(13,12): error TS2345: Argument of type '{ [x: number]: undefined; length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts(13,12): error TS2345: Argument of type '{ length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints4.ts (1 errors) ====
|
||||
@@ -16,4 +16,4 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursi
|
||||
var r = c.foo('');
|
||||
var r2 = r({ length: 3, charAt: (x: number) => { '' } }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ [x: number]: undefined; length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'.
|
||||
!!! error TS2345: Argument of type '{ length: number; charAt: (x: number) => void; }' is not assignable to parameter of type 'string'.
|
||||
Reference in New Issue
Block a user