153 lines
2.4 KiB
Text
153 lines
2.4 KiB
Text
|
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/undefinedAssignableToEveryType.ts ===
|
||
|
class C {
|
||
|
>C : C
|
||
|
|
||
|
foo: string;
|
||
|
>foo : string
|
||
|
}
|
||
|
var ac: C;
|
||
|
>ac : C
|
||
|
>C : C
|
||
|
|
||
|
interface I {
|
||
|
>I : I
|
||
|
|
||
|
foo: string;
|
||
|
>foo : string
|
||
|
}
|
||
|
var ai: I;
|
||
|
>ai : I
|
||
|
>I : I
|
||
|
|
||
|
enum E { A }
|
||
|
>E : E
|
||
|
>A : E
|
||
|
|
||
|
var ae: E;
|
||
|
>ae : E
|
||
|
>E : E
|
||
|
|
||
|
var b: number = undefined;
|
||
|
>b : number
|
||
|
>undefined : undefined
|
||
|
|
||
|
var c: string = undefined;
|
||
|
>c : string
|
||
|
>undefined : undefined
|
||
|
|
||
|
var d: boolean = undefined;
|
||
|
>d : boolean
|
||
|
>undefined : undefined
|
||
|
|
||
|
var e: Date = undefined;
|
||
|
>e : Date
|
||
|
>Date : Date
|
||
|
>undefined : undefined
|
||
|
|
||
|
var f: any = undefined;
|
||
|
>f : any
|
||
|
>undefined : undefined
|
||
|
|
||
|
var g: void = undefined;
|
||
|
>g : void
|
||
|
>undefined : undefined
|
||
|
|
||
|
var h: Object = undefined;
|
||
|
>h : Object
|
||
|
>Object : Object
|
||
|
>undefined : undefined
|
||
|
|
||
|
var i: {} = undefined;
|
||
|
>i : {}
|
||
|
>undefined : undefined
|
||
|
|
||
|
var j: () => {} = undefined;
|
||
|
>j : () => {}
|
||
|
>undefined : undefined
|
||
|
|
||
|
var k: Function = undefined;
|
||
|
>k : Function
|
||
|
>Function : Function
|
||
|
>undefined : undefined
|
||
|
|
||
|
var l: (x: number) => string = undefined;
|
||
|
>l : (x: number) => string
|
||
|
>x : number
|
||
|
>undefined : undefined
|
||
|
|
||
|
ac = undefined;
|
||
|
>ac = undefined : undefined
|
||
|
>ac : C
|
||
|
>undefined : undefined
|
||
|
|
||
|
ai = undefined;
|
||
|
>ai = undefined : undefined
|
||
|
>ai : I
|
||
|
>undefined : undefined
|
||
|
|
||
|
ae = undefined;
|
||
|
>ae = undefined : undefined
|
||
|
>ae : E
|
||
|
>undefined : undefined
|
||
|
|
||
|
var m: number[] = undefined;
|
||
|
>m : number[]
|
||
|
>undefined : undefined
|
||
|
|
||
|
var n: { foo: string } = undefined;
|
||
|
>n : { foo: string; }
|
||
|
>foo : string
|
||
|
>undefined : undefined
|
||
|
|
||
|
var o: <T>(x: T) => T = undefined;
|
||
|
>o : <T>(x: T) => T
|
||
|
>T : T
|
||
|
>x : T
|
||
|
>T : T
|
||
|
>T : T
|
||
|
>undefined : undefined
|
||
|
|
||
|
var p: Number = undefined;
|
||
|
>p : Number
|
||
|
>Number : Number
|
||
|
>undefined : undefined
|
||
|
|
||
|
var q: String = undefined;
|
||
|
>q : String
|
||
|
>String : String
|
||
|
>undefined : undefined
|
||
|
|
||
|
function foo<T, U, V extends Date>(x: T, y: U, z: V) {
|
||
|
>foo : <T, U, V extends Date>(x: T, y: U, z: V) => void
|
||
|
>T : T
|
||
|
>U : U
|
||
|
>V : V
|
||
|
>Date : Date
|
||
|
>x : T
|
||
|
>T : T
|
||
|
>y : U
|
||
|
>U : U
|
||
|
>z : V
|
||
|
>V : V
|
||
|
|
||
|
x = undefined;
|
||
|
>x = undefined : undefined
|
||
|
>x : T
|
||
|
>undefined : undefined
|
||
|
|
||
|
y = undefined;
|
||
|
>y = undefined : undefined
|
||
|
>y : U
|
||
|
>undefined : undefined
|
||
|
|
||
|
z = undefined;
|
||
|
>z = undefined : undefined
|
||
|
>z : V
|
||
|
>undefined : undefined
|
||
|
}
|
||
|
//function foo<T, U extends T, V extends Date>(x: T, y: U, z: V) {
|
||
|
// x = undefined;
|
||
|
// y = undefined;
|
||
|
// z = undefined;
|
||
|
//}
|