2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/statements/forStatements/forStatementsMultipleValidDecl.ts ===
|
|
|
|
// all expected to be valid
|
|
|
|
|
|
|
|
for (var x: number; ;) { }
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
for (var x = 2; ;) { }
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
for (var x = <number>undefined; ;) { }
|
|
|
|
>x : number
|
|
|
|
><number>undefined : number
|
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
// new declaration space, making redeclaring x as a string valid
|
|
|
|
function declSpace() {
|
|
|
|
>declSpace : () => void
|
|
|
|
|
|
|
|
for (var x = 'this is a string'; ;) { }
|
|
|
|
>x : string
|
|
|
|
}
|
|
|
|
interface Point { x: number; y: number; }
|
|
|
|
>Point : Point
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
for (var p: Point; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>Point : Point
|
|
|
|
|
|
|
|
for (var p = { x: 1, y: 2 }; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>{ x: 1, y: 2 } : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
for (var p: Point = { x: 0, y: undefined }; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>Point : Point
|
|
|
|
>{ x: 0, y: undefined } : { x: number; y: undefined; }
|
|
|
|
>x : number
|
2014-09-10 21:58:30 +02:00
|
|
|
>y : undefined
|
2014-08-15 23:33:16 +02:00
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
for (var p = { x: 1, y: <number>undefined }; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>{ x: 1, y: <number>undefined } : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
><number>undefined : number
|
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
>{ x: 1, y: 2 } : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { }
|
|
|
|
>p : Point
|
|
|
|
><{ x: number; y: number; }>{ x: 0, y: undefined } : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
>{ x: 0, y: undefined } : { x: number; y: undefined; }
|
|
|
|
>x : number
|
2014-09-10 21:58:30 +02:00
|
|
|
>y : undefined
|
2014-08-15 23:33:16 +02:00
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
for (var p: typeof p; ;) { }
|
|
|
|
>p : Point
|
|
|
|
>p : Point
|
|
|
|
|
|
|
|
for (var fn = function (s: string) { return 42; }; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
>function (s: string) { return 42; } : (s: string) => number
|
|
|
|
>s : string
|
|
|
|
|
|
|
|
for (var fn = (s: string) => 3; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
>(s: string) => 3 : (s: string) => number
|
|
|
|
>s : string
|
|
|
|
|
|
|
|
for (var fn: (s: string) => number; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
>s : string
|
|
|
|
|
|
|
|
for (var fn: { (s: string): number }; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
>s : string
|
|
|
|
|
|
|
|
for (var fn = <(s: string) => number> null; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
><(s: string) => number> null : (s: string) => number
|
|
|
|
>s : string
|
|
|
|
|
|
|
|
for (var fn: typeof fn; ;) { }
|
|
|
|
>fn : (s: string) => number
|
|
|
|
>fn : (s: string) => number
|
|
|
|
|
|
|
|
for (var a: string[]; ;) { }
|
|
|
|
>a : string[]
|
|
|
|
|
|
|
|
for (var a = ['a', 'b']; ;) { }
|
|
|
|
>a : string[]
|
|
|
|
>['a', 'b'] : string[]
|
|
|
|
|
|
|
|
for (var a = <string[]>[]; ;) { }
|
|
|
|
>a : string[]
|
|
|
|
><string[]>[] : string[]
|
2014-10-13 15:56:58 +02:00
|
|
|
>[] : undefined[]
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
for (var a: string[] = []; ;) { }
|
|
|
|
>a : string[]
|
2014-10-13 15:56:58 +02:00
|
|
|
>[] : undefined[]
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
for (var a = new Array<string>(); ;) { }
|
|
|
|
>a : string[]
|
|
|
|
>new Array<string>() : string[]
|
2014-10-29 05:21:47 +01:00
|
|
|
>Array : ArrayConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
for (var a: typeof a; ;) { }
|
|
|
|
>a : string[]
|
|
|
|
>a : string[]
|
|
|
|
|