134 lines
No EOL
7.2 KiB
Text
134 lines
No EOL
7.2 KiB
Text
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(9,1): error TS2323: Type 'F' is not assignable to type 'E'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(10,1): error TS2323: Type 'E' is not assignable to type 'F'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(29,9): error TS2323: Type 'E' is not assignable to type 'string'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(30,9): error TS2323: Type 'E' is not assignable to type 'boolean'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(31,9): error TS2322: Type 'E' is not assignable to type 'Date':
|
|
Property 'toDateString' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(33,9): error TS2323: Type 'E' is not assignable to type 'void'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(36,9): error TS2323: Type 'E' is not assignable to type '() => {}'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(37,9): error TS2322: Type 'E' is not assignable to type 'Function':
|
|
Property 'apply' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(38,9): error TS2323: Type 'E' is not assignable to type '(x: number) => string'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(39,5): error TS2322: Type 'E' is not assignable to type 'C':
|
|
Property 'foo' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(40,5): error TS2322: Type 'E' is not assignable to type 'I':
|
|
Property 'foo' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(41,9): error TS2322: Type 'E' is not assignable to type 'number[]':
|
|
Property 'length' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(42,9): error TS2322: Type 'E' is not assignable to type '{ foo: string; }':
|
|
Property 'foo' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(43,9): error TS2323: Type 'E' is not assignable to type '<T>(x: T) => T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(45,9): error TS2322: Type 'E' is not assignable to type 'String':
|
|
Property 'charAt' is missing in type 'Number'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(47,21): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(48,9): error TS2323: Type 'E' is not assignable to type 'T'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(49,9): error TS2323: Type 'E' is not assignable to type 'U'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(50,9): error TS2323: Type 'E' is not assignable to type 'V'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(51,13): error TS2323: Type 'E' is not assignable to type 'A'.
|
|
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts(52,13): error TS2323: Type 'E' is not assignable to type 'B'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignability.ts (21 errors) ====
|
|
// enums assignable to number, any, Object, errors unless otherwise noted
|
|
|
|
enum E { A }
|
|
enum F { B }
|
|
|
|
var e = E.A;
|
|
var f = F.B;
|
|
|
|
e = f;
|
|
~
|
|
!!! error TS2323: Type 'F' is not assignable to type 'E'.
|
|
f = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'F'.
|
|
e = 1; // ok
|
|
f = 1; // ok
|
|
var x: number = e; // ok
|
|
x = f; // ok
|
|
|
|
module Others {
|
|
var a: any = e; // ok
|
|
|
|
class C {
|
|
foo: string;
|
|
}
|
|
var ac: C;
|
|
interface I {
|
|
foo: string;
|
|
}
|
|
var ai: I;
|
|
|
|
var b: number = e; // ok
|
|
var c: string = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'string'.
|
|
var d: boolean = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'boolean'.
|
|
var ee: Date = e;
|
|
~~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'Date':
|
|
!!! error TS2322: Property 'toDateString' is missing in type 'Number'.
|
|
var f: any = e; // ok
|
|
var g: void = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'void'.
|
|
var h: Object = e;
|
|
var i: {} = e;
|
|
var j: () => {} = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type '() => {}'.
|
|
var k: Function = e;
|
|
~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'Function':
|
|
!!! error TS2322: Property 'apply' is missing in type 'Number'.
|
|
var l: (x: number) => string = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type '(x: number) => string'.
|
|
ac = e;
|
|
~~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'C':
|
|
!!! error TS2322: Property 'foo' is missing in type 'Number'.
|
|
ai = e;
|
|
~~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'I':
|
|
!!! error TS2322: Property 'foo' is missing in type 'Number'.
|
|
var m: number[] = e;
|
|
~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'number[]':
|
|
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
|
var n: { foo: string } = e;
|
|
~
|
|
!!! error TS2322: Type 'E' is not assignable to type '{ foo: string; }':
|
|
!!! error TS2322: Property 'foo' is missing in type 'Number'.
|
|
var o: <T>(x: T) => T = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type '<T>(x: T) => T'.
|
|
var p: Number = e;
|
|
var q: String = e;
|
|
~
|
|
!!! error TS2322: Type 'E' is not assignable to type 'String':
|
|
!!! error TS2322: Property 'charAt' is missing in type 'Number'.
|
|
|
|
function foo<T, U extends T, V extends Date, A extends Number, B extends E>(x: T, y: U, z: V) {
|
|
~~~~~~~~~~~
|
|
!!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
|
x = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'T'.
|
|
y = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'U'.
|
|
z = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'V'.
|
|
var a: A = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'A'.
|
|
var b: B = e;
|
|
~
|
|
!!! error TS2323: Type 'E' is not assignable to type 'B'.
|
|
}
|
|
} |