2014-11-02 07:54:55 +01:00
|
|
|
=== tests/cases/conformance/types/typeAliases/typeAliases.ts ===
|
|
|
|
// Writing a reference to a type alias has exactly the same effect as writing the aliased type itself.
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
type T1 = number;
|
|
|
|
>T1 : number
|
|
|
|
|
|
|
|
var x1: number;
|
|
|
|
>x1 : number
|
|
|
|
|
|
|
|
var x1: T1;
|
|
|
|
>x1 : number
|
|
|
|
>T1 : number
|
|
|
|
|
|
|
|
type T2 = string;
|
|
|
|
>T2 : string
|
|
|
|
|
|
|
|
var x2: string;
|
|
|
|
>x2 : string
|
|
|
|
|
|
|
|
var x2: T2;
|
|
|
|
>x2 : string
|
|
|
|
>T2 : string
|
|
|
|
|
|
|
|
type T3 = boolean;
|
|
|
|
>T3 : boolean
|
|
|
|
|
|
|
|
var x3: boolean;
|
|
|
|
>x3 : boolean
|
|
|
|
|
|
|
|
var x3: T3;
|
|
|
|
>x3 : boolean
|
|
|
|
>T3 : boolean
|
|
|
|
|
|
|
|
type T4 = void;
|
|
|
|
>T4 : void
|
|
|
|
|
|
|
|
var x4: void;
|
|
|
|
>x4 : void
|
|
|
|
|
|
|
|
var x4: T4;
|
|
|
|
>x4 : void
|
|
|
|
>T4 : void
|
|
|
|
|
|
|
|
type T5 = any;
|
|
|
|
>T5 : any
|
|
|
|
|
|
|
|
var x5: any;
|
|
|
|
>x5 : any
|
|
|
|
|
|
|
|
var x5: T5;
|
|
|
|
>x5 : any
|
|
|
|
>T5 : any
|
|
|
|
|
|
|
|
interface I6 { x : string }
|
|
|
|
>I6 : I6
|
|
|
|
>x : string
|
|
|
|
|
|
|
|
type T6 = I6;
|
|
|
|
>T6 : I6
|
|
|
|
>I6 : I6
|
|
|
|
|
|
|
|
var x6: I6;
|
|
|
|
>x6 : I6
|
|
|
|
>I6 : I6
|
|
|
|
|
|
|
|
var x6: T6;
|
|
|
|
>x6 : I6
|
|
|
|
>T6 : I6
|
|
|
|
|
|
|
|
class C7 { x: boolean }
|
|
|
|
>C7 : C7
|
|
|
|
>x : boolean
|
|
|
|
|
|
|
|
type T7 = C7;
|
|
|
|
>T7 : C7
|
|
|
|
>C7 : C7
|
|
|
|
|
|
|
|
var x7: C7;
|
|
|
|
>x7 : C7
|
|
|
|
>C7 : C7
|
|
|
|
|
|
|
|
var x7: T7;
|
|
|
|
>x7 : C7
|
|
|
|
>T7 : C7
|
|
|
|
|
|
|
|
type T8 = string | boolean;
|
|
|
|
>T8 : string | boolean
|
|
|
|
|
|
|
|
var x8: string | boolean;
|
|
|
|
>x8 : string | boolean
|
|
|
|
|
|
|
|
var x8: T8;
|
|
|
|
>x8 : string | boolean
|
|
|
|
>T8 : string | boolean
|
|
|
|
|
|
|
|
type T9 = () => string;
|
|
|
|
>T9 : () => string
|
|
|
|
|
|
|
|
var x9: () => string;
|
|
|
|
>x9 : () => string
|
|
|
|
|
|
|
|
var x9: T9;
|
|
|
|
>x9 : () => string
|
|
|
|
>T9 : () => string
|
|
|
|
|
|
|
|
type T10 = { x: number };
|
|
|
|
>T10 : { x: number; }
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
var x10: { x: number };
|
|
|
|
>x10 : { x: number; }
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
var x10: T10;
|
|
|
|
>x10 : { x: number; }
|
|
|
|
>T10 : { x: number; }
|
|
|
|
|
|
|
|
type T11 = { new(): boolean };
|
|
|
|
>T11 : new () => boolean
|
|
|
|
|
|
|
|
var x11: { new(): boolean };
|
|
|
|
>x11 : new () => boolean
|
|
|
|
|
|
|
|
var x11: T11;
|
|
|
|
>x11 : new () => boolean
|
|
|
|
>T11 : new () => boolean
|
|
|
|
|
|
|
|
interface I13 { x: string };
|
|
|
|
>I13 : I13
|
|
|
|
>x : string
|
|
|
|
|
|
|
|
type T13 = I13;
|
|
|
|
>T13 : I13
|
|
|
|
>I13 : I13
|
|
|
|
|
|
|
|
var x13_1: I13;
|
|
|
|
>x13_1 : I13
|
|
|
|
>I13 : I13
|
|
|
|
|
|
|
|
var x13_2: T13
|
|
|
|
>x13_2 : I13
|
|
|
|
>T13 : I13
|
|
|
|
|
|
|
|
declare function foo13<T1 extends I13, T2 extends T13>(t1: T1, t2: T13): void;
|
|
|
|
>foo13 : <T1 extends I13, T2 extends I13>(t1: T1, t2: I13) => void
|
|
|
|
>T1 : T1
|
|
|
|
>I13 : I13
|
|
|
|
>T2 : T2
|
|
|
|
>T13 : I13
|
|
|
|
>t1 : T1
|
|
|
|
>T1 : T1
|
|
|
|
>t2 : I13
|
|
|
|
>T13 : I13
|
|
|
|
|
|
|
|
foo13(x13_1, x13_2);
|
|
|
|
>foo13(x13_1, x13_2) : void
|
|
|
|
>foo13 : <T1 extends I13, T2 extends I13>(t1: T1, t2: I13) => void
|
|
|
|
>x13_1 : I13
|
|
|
|
>x13_2 : I13
|
|
|
|
|
|
|
|
foo13(x13_2, x13_1);
|
|
|
|
>foo13(x13_2, x13_1) : void
|
|
|
|
>foo13 : <T1 extends I13, T2 extends I13>(t1: T1, t2: I13) => void
|
|
|
|
>x13_2 : I13
|
|
|
|
>x13_1 : I13
|
|
|
|
|
|
|
|
type T14 = string;
|
|
|
|
>T14 : string
|
|
|
|
|
|
|
|
var x14: T14;
|
|
|
|
>x14 : string
|
|
|
|
>T14 : string
|
|
|
|
|
|
|
|
declare function foo14_1(x: T14): void;
|
|
|
|
>foo14_1 : (x: string) => void
|
|
|
|
>x : string
|
|
|
|
>T14 : string
|
|
|
|
|
|
|
|
declare function foo14_2(x: "click"): void;
|
|
|
|
>foo14_2 : { (x: "click"): void; (x: string): void; }
|
|
|
|
>x : "click"
|
|
|
|
|
|
|
|
declare function foo14_2(x: T14): void;
|
|
|
|
>foo14_2 : { (x: "click"): void; (x: string): void; }
|
|
|
|
>x : string
|
|
|
|
>T14 : string
|
|
|
|
|
2014-11-02 07:54:55 +01:00
|
|
|
type Meters = number
|
|
|
|
>Meters : number
|
|
|
|
|
|
|
|
enum E { x = 10 }
|
|
|
|
>E : E
|
|
|
|
>x : E
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
declare function f15(a: string): boolean;
|
|
|
|
>f15 : { (a: string): boolean; (a: number): string; }
|
2014-11-02 07:54:55 +01:00
|
|
|
>a : string
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
declare function f15(a: Meters): string;
|
|
|
|
>f15 : { (a: string): boolean; (a: number): string; }
|
2014-11-02 07:54:55 +01:00
|
|
|
>a : number
|
|
|
|
>Meters : number
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
f15(E.x).toLowerCase();
|
|
|
|
>f15(E.x).toLowerCase() : string
|
|
|
|
>f15(E.x).toLowerCase : () => string
|
|
|
|
>f15(E.x) : string
|
|
|
|
>f15 : { (a: string): boolean; (a: number): string; }
|
2014-11-02 07:54:55 +01:00
|
|
|
>E.x : E
|
|
|
|
>E : typeof E
|
|
|
|
>x : E
|
|
|
|
>toLowerCase : () => string
|
|
|
|
|
|
|
|
type StringAndBoolean = [string, boolean]
|
|
|
|
>StringAndBoolean : [string, boolean]
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
declare function f16(s: StringAndBoolean): string;
|
|
|
|
>f16 : (s: [string, boolean]) => string
|
2014-11-02 07:54:55 +01:00
|
|
|
>s : [string, boolean]
|
|
|
|
>StringAndBoolean : [string, boolean]
|
|
|
|
|
|
|
|
var x: [string, boolean];
|
|
|
|
>x : [string, boolean]
|
|
|
|
|
2014-11-02 22:34:04 +01:00
|
|
|
f16(x);
|
|
|
|
>f16(x) : string
|
|
|
|
>f16 : (s: [string, boolean]) => string
|
2014-11-02 07:54:55 +01:00
|
|
|
>x : [string, boolean]
|
|
|
|
|
|
|
|
var y: StringAndBoolean = ["1", false];
|
|
|
|
>y : [string, boolean]
|
|
|
|
>StringAndBoolean : [string, boolean]
|
|
|
|
>["1", false] : [string, boolean]
|
|
|
|
|
|
|
|
y[0].toLowerCase();
|
|
|
|
>y[0].toLowerCase() : string
|
|
|
|
>y[0].toLowerCase : () => string
|
|
|
|
>y[0] : string
|
|
|
|
>y : [string, boolean]
|
|
|
|
>toLowerCase : () => string
|
|
|
|
|