mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 04:32:01 +03:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
|
// @allowUnreachableCode: true
|
||
|
|
||
|
// all expected to be valid
|
||
|
|
||
|
for (var x: number; ;) { }
|
||
|
for (var x = 2; ;) { }
|
||
|
|
||
|
for (var x = <number>undefined; ;) { }
|
||
|
// new declaration space, making redeclaring x as a string valid
|
||
|
function declSpace() {
|
||
|
for (var x = 'this is a string'; ;) { }
|
||
|
}
|
||
|
interface Point { x: number; y: number; }
|
||
|
|
||
|
for (var p: Point; ;) { }
|
||
|
for (var p = { x: 1, y: 2 }; ;) { }
|
||
|
for (var p: Point = { x: 0, y: undefined }; ;) { }
|
||
|
for (var p = { x: 1, y: <number>undefined }; ;) { }
|
||
|
for (var p: { x: number; y: number; } = { x: 1, y: 2 }; ;) { }
|
||
|
for (var p = <{ x: number; y: number; }>{ x: 0, y: undefined }; ;) { }
|
||
|
for (var p: typeof p; ;) { }
|
||
|
|
||
|
for (var fn = function (s: string) { return 42; }; ;) { }
|
||
|
for (var fn = (s: string) => 3; ;) { }
|
||
|
for (var fn: (s: string) => number; ;) { }
|
||
|
for (var fn: { (s: string): number }; ;) { }
|
||
|
for (var fn = <(s: string) => number> null; ;) { }
|
||
|
for (var fn: typeof fn; ;) { }
|
||
|
|
||
|
for (var a: string[]; ;) { }
|
||
|
for (var a = ['a', 'b']; ;) { }
|
||
|
for (var a = <string[]>[]; ;) { }
|
||
|
for (var a: string[] = []; ;) { }
|
||
|
for (var a = new Array<string>(); ;) { }
|
||
|
for (var a: typeof a; ;) { }
|