swc/crates/swc_ecma_parser/tests/tsc/for-inStatementsInvalid.ts

63 lines
1.2 KiB
TypeScript

var aNumber: number;
for (aNumber in {}) { }
var aBoolean: boolean;
for (aBoolean in {}) { }
var aRegExp: RegExp;
for (aRegExp in {}) { }
for (var idx : number in {}) { }
function fn(): void { }
for (var x in fn()) { }
var c : string, d:string, e;
for (var x in c || d) { }
for (var x in e ? c : d) { }
for (var x in 42 ? c : d) { }
for (var x in '' ? c : d) { }
for (var x in 42 ? d[x] : c[x]) { }
for (var x in c[23]) { }
for (var x in (<T>(x: T) => x)) { }
for (var x in function (x: string, y: number) { return x + y }) { }
class A {
biz() : number{
for (var x in this.biz()) { }
for (var x in this.biz) { }
for (var x in this) { }
return null;
}
static baz() : number {
for (var x in this) { }
for (var x in this.baz) { }
for (var x in this.baz()) { }
return null;
}
}
class B extends A {
boz() {
for (var x in this.biz()) { }
for (var x in this.biz) { }
for (var x in this) { }
for (var x in super.biz) { }
for (var x in super.biz()) { }
return null;
}
}
interface I {
id: number;
[idx: number]: number;
}
var i: I;
for (var x in i[42]) { }