mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Add tests and accept baselines
This commit is contained in:
parent
6798bd576b
commit
8eacd41ab0
@ -2,9 +2,11 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st
|
||||
Property 'one' is missing in type '{ [index: string]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
|
||||
Property 'one' is missing in type '{ [index: number]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
Index signature is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (2 errors) ====
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (3 errors) ====
|
||||
var x = { one: 1 };
|
||||
var y: { [index: string]: any };
|
||||
var z: { [index: number]: any };
|
||||
@ -18,4 +20,10 @@ tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: nu
|
||||
!!! error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
|
||||
!!! error TS2322: Property 'one' is missing in type '{ [index: number]: any; }'.
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
!!! error TS2322: Index signature is missing in type 'String'.
|
||||
z = "foo"; // Error
|
||||
|
||||
|
||||
@ -6,6 +6,9 @@ x = y; // Error
|
||||
y = x; // Ok because index signature type is any
|
||||
x = z; // Error
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
z = "foo"; // Error
|
||||
|
||||
|
||||
|
||||
//// [assignmentCompat1.js]
|
||||
@ -16,3 +19,5 @@ x = y; // Error
|
||||
y = x; // Ok because index signature type is any
|
||||
x = z; // Error
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
z = "foo"; // Error
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
tests/cases/compiler/indexTypeCheck.ts(2,2): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/indexTypeCheck.ts(3,2): error TS1021: An index signature must have a type annotation.
|
||||
tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
|
||||
tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'.
|
||||
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 (7 errors) ====
|
||||
==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ====
|
||||
interface Red {
|
||||
[n:number]; // ok
|
||||
~~~~~~~~~~~
|
||||
@ -36,6 +37,8 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
|
||||
|
||||
interface Green {
|
||||
[n:number]: Orange; // error
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'.
|
||||
[s:string]: Yellow; // ok
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@ tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'.
|
||||
tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
@ -66,12 +68,14 @@ tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'.
|
||||
tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
|
||||
|
||||
==== tests/cases/compiler/intTypeCheck.ts (61 errors) ====
|
||||
==== tests/cases/compiler/intTypeCheck.ts (63 errors) ====
|
||||
interface i1 {
|
||||
//Property Signatures
|
||||
p;
|
||||
@ -280,6 +284,9 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj40: i4 = function foo() { };
|
||||
var obj41: i4 = <i4> anyVar;
|
||||
var obj42: i4 = new <i4> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i4'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
@ -402,6 +409,9 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
//var obj84: i8 = function foo() { };
|
||||
var obj85: i8 = <i8> anyVar;
|
||||
var obj86: i8 = new <i8> anyVar;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'i8'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
|
||||
@ -5,3 +5,6 @@ x = y; // Error
|
||||
y = x; // Ok because index signature type is any
|
||||
x = z; // Error
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
z = "foo"; // Error
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user