file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
crates/swc_ecma_parser/tests/tsc/classExtendsItselfIndirectly.ts | TypeScript | class C extends E { foo: string; } // error
class D extends C { bar: string; }
class E extends D { baz: number; }
class C2<T> extends E2<T> { foo: T; } // error
class D2<T> extends C2<T> { bar: T; }
class E2<T> extends D2<T> { baz: T; } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classExtendsItselfIndirectly2.ts | TypeScript | class C extends N.E { foo: string; } // error
module M {
export class D extends C { bar: string; }
}
module N {
export class E extends M.D { baz: number; }
}
module O {
class C2<T> extends Q.E2<T> { foo: T; } // error
module P {
export class D2<T> extends C2<T> { bar: T; }
}
module... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classExtendsItselfIndirectly3.ts | TypeScript | // @Filename: classExtendsItselfIndirectly_file1.ts
class C extends E { foo: string; } // error
// @Filename: classExtendsItselfIndirectly_file2.ts
class D extends C { bar: string; }
// @Filename: classExtendsItselfIndirectly_file3.ts
class E extends D { baz: number; }
// @Filename: classExtendsItselfIndirectly_file... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classExtendsShadowedConstructorFunction.ts | TypeScript | class C { foo: string; }
module M {
var C = 1;
class D extends C { // error, C must evaluate to constructor function
bar: string;
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classExtendsValidConstructorFunction.ts | TypeScript | function foo() { }
var x = new foo(); // can be used as a constructor function
class C extends foo { } // error, cannot extend it though | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classImplementsMergedClassInterface.ts | TypeScript | declare class C1 {
x : number;
}
interface C1 {
y : number;
}
class C2 implements C1 { // error -- missing x
}
class C3 implements C1 { // error -- missing y
x : number;
}
class C4 implements C1 { // error -- missing x
y : number;
}
class C5 implements C1 { // okay
x : number;
y : number;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classInsideBlock.ts | TypeScript | function foo() {
class C { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classIsSubtypeOfBaseType.ts | TypeScript | class Base<T> {
foo: T;
}
class Derived extends Base<{ bar: string; }> {
foo: {
bar: string; baz: number; // ok
}
}
class Derived2 extends Base<{ bar: string; }> {
foo: {
bar?: string; // error
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classPropertyAsPrivate.ts | TypeScript | class C {
private x: string;
private get y() { return null; }
private set y(x) { }
private foo() { }
private static a: string;
private static get b() { return null; }
private static set b(x) { }
private static foo() { }
}
var c: C;
// all errors
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classPropertyAsProtected.ts | TypeScript | class C {
protected x: string;
protected get y() { return null; }
protected set y(x) { }
protected foo() { }
protected static a: string;
protected static get b() { return null; }
protected static set b(x) { }
protected static foo() { }
}
var c: C;
// all errors
c.x;
c.y;
c.y = 1;
c.foo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classPropertyIsPublicByDefault.ts | TypeScript | class C {
x: string;
get y() { return null; }
set y(x) { }
foo() { }
static a: string;
static get b() { return null; }
static set b(x) { }
static foo() { }
}
var c: C;
c.x;
c.y;
c.y = 1;
c.foo();
C.a;
C.b();
C.b = 1;
C.foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock1.ts | TypeScript | // @target: esnext, es2022, es2015, es5
const a = 2;
class C {
static {
const a = 1;
a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock10.ts | TypeScript | // @target: esnext, es2022, es2015, es5
var a1 = 1;
var a2 = 1;
const b1 = 2;
const b2 = 2;
function f () {
var a1 = 11;
const b1 = 22;
class C1 {
static {
var a1 = 111;
var a2 = 111;
const b1 = 222;
const b2 = 222;
}
}
}
class C2 {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock11.ts | TypeScript | // @target: esnext, es2022, es2015
let getX;
class C {
#x = 1
constructor(x: number) {
this.#x = x;
}
static {
// getX has privileged access to #x
getX = (obj: C) => obj.#x;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock12.ts | TypeScript | // @useDefineForClassFields: false
// @target: es2015
class C {
static #x = 1;
static {
C.#x;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock13.ts | TypeScript | // @target: esnext, es2022, es2015
// @useDefineForClassFields: true
class C {
static #x = 123;
static {
console.log(C.#x)
}
foo () {
return C.#x;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock14.ts | TypeScript | // @useDefineForClassFields: false
// @target: es2015
class C {
static #_1 = 1;
static #_3 = 1;
static #_5 = 1;
static {}
static {}
static {}
static {}
static {}
static {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock15.ts | TypeScript | // @target: esnext, es2022, es2015
// @useDefineForClassFields: true
var _C__1;
class C {
static #_1 = 1;
static #_3 = 3;
static #_5 = 5;
static {}
static {}
static {}
static {}
static {}
static {}
}
console.log(_C__1)
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock17.ts | TypeScript | // @target: es2015
let friendA: { getX(o: A): number, setX(o: A, v: number): void };
class A {
#x: number;
constructor (v: number) {
this.#x = v;
}
getX () {
return this.#x;
}
static {
friendA = {
getX(obj) { return obj.#x },
setX(obj, value) { obj.#x = value }
};
}
};
cl... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock18.ts | TypeScript | // @target: esnext, es2022, es2015, es5
function foo () {
return class {
static foo = 1;
static {
const c = class {
static bar = 2;
static {
// do
}
}
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock2.ts | TypeScript | // @target: esnext, es2022, es2015, es5
const a = 1;
const b = 2;
class C {
static {
const a = 11;
a;
b;
}
static {
const a = 11;
a;
b;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock21.ts | TypeScript | class C {
/* jsdocs */
static {
// something
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock24.ts | TypeScript | // @module: commonjs, es2015, es2020, es2022, UMD, AMD, System, esnext
export class C {
static x: number;
static {
C.x = 1;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock25.ts | TypeScript | // @target: esnext, es2022
// @declaration: true
// @declarationMap: true
// @sourceMap: true
const a = 1;
const b = 2;
class C {
static {
const a = 11;
a;
b;
}
static {
const a = 11;
a;
b;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock27.ts | TypeScript | // https://github.com/microsoft/TypeScript/issues/44872
void class Foo {
static prop = 1
static {
console.log(Foo.prop);
Foo.prop++;
}
static {
console.log(Foo.prop);
Foo.prop++;
}
static {
console.log(Foo.prop);
Foo.prop++;
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock28.ts | TypeScript | // @strict: true
let foo: number;
class C {
static {
foo = 1
}
}
console.log(foo) | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock3.ts | TypeScript | // @target: esnext, es2022
const a = 1;
class C {
static f1 = 1;
static {
console.log(C.f1, C.f2, C.f3)
}
static f2 = 2;
static {
console.log(C.f1, C.f2, C.f3)
}
static f3 = 3;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock4.ts | TypeScript | // @target: esnext, es2022
class C {
static s1 = 1;
static {
this.s1;
C.s1;
this.s2;
C.s2;
}
static s2 = 2;
static ss2 = this.s1;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock5.ts | TypeScript | // @target: esnext, es2022, es2015, es5
class B {
static a = 1;
static b = 2;
}
class C extends B {
static b = 3;
static c = super.a
static {
this.b;
super.b;
super.a;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlock9.ts | TypeScript | // @target: esnext, es2022, es2015, es5
class A {
static bar = A.foo + 1
static {
A.foo + 2;
}
static foo = 1;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlockUseBeforeDef2.ts | TypeScript | // @target: esnext, es2022
// @noEmit: true
// @strict: true
class C {
static {
this.x = 1;
}
static x;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classStaticBlockUseBeforeDef3.ts | TypeScript | // @noEmit: true
// @strict: true
class A {
static {
A.doSomething(); // should not error
}
static doSomething() {
console.log("gotcha!");
}
}
class Baz {
static {
console.log(FOO); // should error
}
}
const FOO = "FOO";
class Bar {
static {
console.log(... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithBaseClassButNoConstructor.ts | TypeScript | class Base {
constructor(x: number) { }
}
class C extends Base {
foo: string;
}
var r = C;
var c = new C(); // error
var c2 = new C(1); // ok
class Base2<T,U> {
constructor(x: T) { }
}
class D<T,U> extends Base2<T,U> {
foo: U;
}
var r2 = D;
var d = new D(); // error
var d2 = new D(1); // ok
// spe... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithConstructors.ts | TypeScript | module NonGeneric {
class C {
constructor(x: string) { }
}
var c = new C(); // error
var c2 = new C(''); // ok
class C2 {
constructor(x: number);
constructor(x: string);
constructor(x: any) { }
}
var c3 = new C2(); // error
var c4 = new C2(''); // ok
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithEmptyBody.ts | TypeScript | class C {
}
var c: C;
var o: {} = c;
c = 1;
c = { foo: '' }
c = () => { }
class D {
constructor() {
return 1;
}
}
var d: D;
var o: {} = d;
d = 1;
d = { foo: '' }
d = () => { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithNoConstructorOrBaseClass.ts | TypeScript | class C {
x: string;
}
var c = new C();
var r = C;
class D<T,U> {
x: T;
y: U;
}
var d = new D();
var d2 = new D<string, number>();
var r2 = D;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithOnlyPublicMembersEquivalentToInterface.ts | TypeScript | // @target: es5
// no errors expected
class C {
public x: string;
public y(a: number): number { return null; }
public get z() { return 1; }
public set z(v) { }
[x: string]: Object;
[x: number]: Object;
0: number;
}
interface I {
x: string;
y(b: number): number;
z: number;
[... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithOnlyPublicMembersEquivalentToInterface2.ts | TypeScript | // @target: es5
// no errors expected
class C {
public x: string;
public y(a: number): number { return null; }
public get z() { return 1; }
public set z(v) { }
[x: string]: Object;
[x: number]: Object;
0: number;
public static foo: string; // doesn't effect equivalence
}
interface I {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithOptionalParameter.ts | TypeScript | // classes do not permit optional parameters, these are errors
class C {
x?: string;
f?() {}
}
class C2<T> {
x?: T;
f?(x: T) {}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithPredefinedTypesAsNames.ts | TypeScript | // classes cannot use predefined types as names
class any { }
class number { }
class boolean { }
class string { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithPrivateProperty.ts | TypeScript | // accessing any private outside the class is an error
class C {
private x;
private a = '';
private b: string = '';
private c() { return '' }
private d = () => '';
private static e;
private static f() { return '' }
private static g = () => '';
}
var c = new C();
var r1: string = c.x;
v... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithProtectedProperty.ts | TypeScript | // accessing any protected outside the class is an error
class C {
protected x;
protected a = '';
protected b: string = '';
protected c() { return '' }
protected d = () => '';
protected static e;
protected static f() { return '' }
protected static g = () => '';
}
class D extends C {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithPublicProperty.ts | TypeScript | class C {
public x;
public a = '';
public b: string = '';
public c() { return '' }
public d = () => '';
public static e;
public static f() { return '' }
public static g = () => '';
}
// all of these are valid
var c = new C();
var r1: string = c.x;
var r2: string = c.a;
var r3: string = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithSemicolonClassElement1.ts | TypeScript | class C {
;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithSemicolonClassElement2.ts | TypeScript | class C {
;
;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithSemicolonClassElementES61.ts | TypeScript | //@target: es6
class C {
;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithSemicolonClassElementES62.ts | TypeScript | //@target: es6
class C {
;
;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterBindingPattern.2.ts | TypeScript | // @target: esnext,es2015,es5
// @noTypesAndSymbols: true
// @noEmit: true
// @useDefineForClassFields: false
// https://github.com/microsoft/TypeScript/issues/36295
class C {}
(({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })();
const x = "";
(({ [class extends C { static x = 1 }.x]: b = "" }, d = x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterBindingPattern.3.ts | TypeScript | // @target: esnext
// @noTypesAndSymbols: true
// @noEmit: true
// @useDefineForClassFields: true
// https://github.com/microsoft/TypeScript/issues/36295
class C {}
(({ [class extends C { static x = 1 }.x]: b = "" }) => { var C; })();
const x = "";
(({ [class extends C { static x = 1 }.x]: b = "" }, d = x) => { var x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterBindingPattern.ts | TypeScript | // @target: esnext,es2015,es5
// @noTypesAndSymbols: true
// https://github.com/microsoft/TypeScript/issues/36295
(({ [class { static x = 1 }.x]: b = "" }) => {})(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterInitializer.2.ts | TypeScript | // @target: esnext,es2015,es5
// @noTypesAndSymbols: true
// @noEmit: true
// @useDefineForClassFields: false
// https://github.com/microsoft/TypeScript/issues/36295
class C {}
((b = class extends C { static x = 1 }) => { var C; })();
const x = "";
((b = class extends C { static x = 1 }, d = x) => { var x; })(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterInitializer.3.ts | TypeScript | // @target: esnext
// @noTypesAndSymbols: true
// @noEmit: true
// @useDefineForClassFields: true
// https://github.com/microsoft/TypeScript/issues/36295
class C {}
((b = class extends C { static x = 1 }) => { var C; })();
const x = "";
((b = class extends C { static x = 1 }, d = x) => { var x; })(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticFieldInParameterInitializer.ts | TypeScript | // @target: esnext,es2015,es5
// @noTypesAndSymbols: true
// https://github.com/microsoft/TypeScript/issues/36295
((b = class { static x = 1 }) => {})(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithStaticMembers.ts | TypeScript | class C {
static fn() { return this; }
static get x() { return 1; }
static set x(v) { }
constructor(public a: number, private b: number) { }
static foo: string;
}
var r = C.fn();
var r2 = r.x;
var r3 = r.foo;
class D extends C {
bar: string;
}
var r = D.fn();
var r2 = r.x;
var r3 = r.foo; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithTwoConstructorDefinitions.ts | TypeScript | class C {
constructor() { } // error
constructor(x) { } // error
}
class D<T> {
constructor(x: T) { } // error
constructor(x: T, y: T) { } // error
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/classWithoutExplicitConstructor.ts | TypeScript | class C {
x = 1
y = 'hello';
}
var c = new C();
var c2 = new C(null); // error
class D<T extends Date> {
x = 2
y: T = null;
}
var d = new D();
var d2 = new D(null); // error | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorInvalidAssignmentType.ts | TypeScript | // @allowUnreachableCode: true
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var resultIsBoolean: boolean
var resultIsNumber: number
var resultIsString: string
//Expect errors when the results type is different form the second operand
resultIsBoolean = (BOOLEAN, STRING);
resultIsBoolean = (BOOLEAN, N... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorOtherInvalidOperation.ts | TypeScript | // @allowUnreachableCode: true
//Expect to have compiler errors
//Comma operator in function arguments and return
function foo(x: number, y: string) {
return x, y;
}
var resultIsString: number = foo(1, "123"); //error here
//TypeParameters
function foo1<T1, T2>() {
var x: T1;
var y: T2;
var result: T1... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorOtherValidOperation.ts | TypeScript | // @allowUnreachableCode: true
//Comma operator in for loop
for (var i = 0, j = 10; i < j; i++, j--)
{
}
//Comma operator in function arguments and return
function foo(x: number, y: string)
{
return x, y;
}
var resultIsString = foo(1, "123");
//TypeParameters
function foo1<T1, T2>()
{
var x: T1;
var y: T... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorWithSecondOperandAnyType.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
//The second operand type is any
ANY, ANY;
BOOLEAN, ANY;
NUMBER, ANY;
STRING, ANY;
OBJECT, ANY;
//Return type is any
var resultIsAny1 = (ANY, ANY);
var resultIsAny2 = (BOOLEAN, ANY);
var res... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorWithSecondOperandBooleanType.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
//The second operand type is boolean
ANY, BOOLEAN;
BOOLEAN, BOOLEAN;
NUMBER, BOOLEAN;
STRING, BOOLEAN;
OBJECT, BOOLEAN;
//Return type is boolean
var resultIsBoolean1 = (ANY, BOOLEAN);
var re... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorWithSecondOperandNumberType.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
//The second operand type is number
ANY, NUMBER;
BOOLEAN, NUMBER;
NUMBER, NUMBER;
STRING, NUMBER;
OBJECT, NUMBER;
//Return type is number
var resultIsNumber1 = (ANY, NUMBER);
var resultIsNum... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorWithSecondOperandObjectType.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
class CLASS {
num: number;
}
//The second operand type is Object
ANY, OBJECT;
BOOLEAN, OBJECT;
NUMBER, OBJECT;
STRING, OBJECT;
OBJECT, OBJECT;
//Return type is Object
var resultIsObject... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorWithSecondOperandStringType.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
var resultIsString: string;
//The second operand is string
ANY, STRING;
BOOLEAN, STRING;
NUMBER, STRING;
STRING, STRING;
OBJECT, STRING;
//Return type is string
var resultIsString1 = (ANY, ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commaOperatorsMultipleOperators.ts | TypeScript | // @allowUnreachableCode: true
var ANY: any;
var BOOLEAN: boolean;
var NUMBER: number;
var STRING: string;
var OBJECT: Object;
//Expected: work well
ANY, BOOLEAN, NUMBER;
BOOLEAN, NUMBER, STRING;
NUMBER, STRING, OBJECT;
STRING, OBJECT, ANY;
OBJECT, ANY, BOOLEAN;
//Results should have the same type as the third opera... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commentEmittingInPreserveJsx1.tsx | TypeScript (TSX) | // @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @skipLibCheck: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
<div>
// Not Comment
</div>;
<div>
// Not Comment
{
//Comment just Fine
}
// Another not Comment
</div>;
<div>
// Not Comment
{
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSAliasedExport.ts | TypeScript | // @checkJs: true
// @outdir: out/
// @declaration: true
// @Filename: commonJSAliasedExport.js
const donkey = (ast) => ast;
function funky(declaration) {
return false;
}
module.exports = donkey;
module.exports.funky = funky;
// @Filename: bug43713.js
const { funky } = require('./commonJSAliasedExport');
/** @ty... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSImportAsPrimaryExpression.ts | TypeScript | // @module: commonjs
// @Filename: foo_0.ts
export class C1 {
m1 = 42;
static s1 = true;
}
// @Filename: foo_1.ts
import foo = require("./foo_0");
if(foo.C1.s1){
// Should cause runtime import
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSImportClassTypeReference.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @outDir: out
// @declaration: true
// @filename: main.js
const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
k.values()
}
// @filename: mod1.js
class K {
values() {
return new K()
}
}
exports.K = K;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSImportExportedClassExpression.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @outDir: out
// @declaration: true
// @filename: main.js
const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
k.values()
}
// @filename: mod1.js
exports.K = class K {
values() {
}
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSImportNestedClassTypeReference.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @outDir: out
// @declaration: true
// @filename: main.js
const { K } = require("./mod1");
/** @param {K} k */
function f(k) {
k.values()
}
// @filename: mod1.js
var NS = {}
NS.K =class {
values() {
return new NS.K()
}
}
exports.K = NS.K;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSImportNotAsPrimaryExpression.ts | TypeScript | // @module: commonjs
// @Filename: foo_0.ts
export class C1 {
m1 = 42;
static s1 = true;
}
export interface I1 {
name: string;
age: number;
}
export module M1 {
export interface I2 {
foo: string;
}
}
export enum E1 {
A,B,C
}
// @Filename: foo_1.ts
import foo = require("./foo_0");
// None of the below shoul... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonJSReexport.ts | TypeScript | // #41422, based on prettier's exports
// @noEmit: true
// @checkJS: true
// @filename: first.js
const hardline = { type: "hard" }
module.exports = {
hardline
}
// @filename: second.js
module.exports = {
nested: require('./first')
};
// @filename: main.js
const { hardline } = require('./second').nested;
hardlin... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/commonTypeIntersection.ts | TypeScript | declare let x1: { __typename?: 'TypeTwo' } & { a: boolean };
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here
declare let x2: { __typename?: 'TypeTwo' } & string;
let y2: { __typename?: 'TypeOne' } & string = x2; // should error here
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithIdenticalObjects.ts | TypeScript | class A1 {
public a: string;
public b: number;
public c: boolean;
public d: any;
public e: Object;
public fn(a: string): string {
return null;
}
}
class B1 {
public a: string;
public b: number;
public c: boolean;
public d: any;
public e: Object;
public fn(b: s... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithIdenticalTypeParameter.ts | TypeScript | function foo<T>(t: T) {
var r1 = t < t;
var r2 = t > t;
var r3 = t <= t;
var r4 = t >= t;
var r5 = t == t;
var r6 = t != t;
var r7 = t === t;
var r8 = t !== t;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithIntersectionType.ts | TypeScript | declare let a: { a: 1 }
a > 1;
declare let b: { a: 1 } & { b: number }
b > 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class C {
public c: string;
}
var a1: { fn(): Base };
var b1: { new (): Base };
var a2: { fn(a: number, b: string): void };
var b2: { fn(a: string): void };
var a3: { fn(a: Base, b: string): void };
var b3: { fn(a: Derive... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class C {
public c: string;
}
var a1: { fn(): Base };
var b1: { new (): Base };
var a2: { new (a: number, b: string): Base };
var b2: { new (a: string): Base };
var a3: { new (a: Base, b: string): Base };
var b3: { new (a... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class C {
public c: string;
}
var a1: { [a: string]: string };
var b1: { [b: string]: number };
var a2: { [index: string]: Base };
var b2: { [index: string]: C };
var a3: { [index: number]: Base };
var b3: { [index: numbe... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class C {
public c: string;
}
var a1: { fn<T>(x: T): T };
var b1: { fn(): string };
var a2: { fn<T>(x: T): T };
var b2: { fn(x: string): number };
var a3: { fn<T>(x?: T): T };
var b3: { fn(x?: string): number };
var a4: ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class C {
public c: string;
}
var a1: { new <T>(x: T): T };
var b1: { new (): string };
var a2: { new <T>(x: T): T };
var b2: { new (x: string): number };
var a3: { new <T>(x?: T): T };
var b3: { new (x?: string): number ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnOptionalProperty.ts | TypeScript | interface A1 {
b?: number;
}
interface B1 {
b?: string;
}
var a: A1;
var b: B1;
// operator <
var ra1 = a < b;
var ra2 = b < a;
// operator >
var rb1 = a > b;
var rb2 = b > a;
// operator <=
var rc1 = a <= b;
var rc2 = b <= a;
// operator >=
var rd1 = a >= b;
var rd2 = b >= a;
// operator ==
var re1 = a ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipObjectsOnProperty.ts | TypeScript | class A1 {
public a: number;
}
class B1 {
public a: string;
}
class A2 {
private a: string;
}
class B2 {
private a: string;
}
var a1: A1;
var b1: B1;
var a2: A2;
var b2: B2;
// operator <
var r1a1 = a1 < b1;
var r1a2 = a2 < b2;
var r1b1 = b1 < a1;
var r1b2 = b2 < a2;
// operator >
var r2a1 = a1 >... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipPrimitiveType.ts | TypeScript | enum E { a, b, c }
var a: number;
var b: boolean;
var c: string;
var d: void;
var e: E;
// operator <
var r1a1 = a < b;
var r1a1 = a < c;
var r1a1 = a < d;
var r1a1 = a < e; // no error, expected
var r1b1 = b < a;
var r1b1 = b < c;
var r1b1 = b < d;
var r1b1 = b < e;
var r1c1 = c < a;
var r1c1 = c < b;
var r1c1 = c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNoRelationshipTypeParameter.ts | TypeScript | enum E { a, b, c }
var a: boolean;
var b: number;
var c: string;
var d: void;
var e: E;
var f: { a: string };
var g: any[];
function foo<T, U>(t: T, u: U) {
var r1 = t < u;
var r2 = t > u;
var r3 = t <= u;
var r4 = t >= u;
var r5 = t == u;
var r6 = t != u;
var r7 = t === u;
var r8 = t ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNumberOperand.ts | TypeScript | // @strict: true
// @noEmit: true
// repro #52036
declare const t1: number | Promise<number>
t1 >= 0 // error
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithNumericLiteral.ts | TypeScript | type BrandedNum = number & { __numberBrand: any };
var x : BrandedNum;
// operator >
x > 0;
x > <number>0;
x > <BrandedNum>0;
// operator <
x < 0;
x < <number>0;
x < <BrandedNum>0;
// operator >=
x >= 0;
x >= <number>0;
x >= <BrandedNum>0;
// operator <=
x <= 0;
x <= <number>0;
x <= <BrandedNum>0;
// operator ==
x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithOneOperandIsAny.ts | TypeScript | var x: any;
enum E { a, b, c }
function foo<T>(t: T) {
var foo_r1 = t < x;
var foo_r2 = t > x;
var foo_r3 = t <= x;
var foo_r4 = t >= x;
var foo_r5 = t == x;
var foo_r6 = t != x;
var foo_r7 = t === x;
var foo_r8 = t !== x;
var foo_r1 = x < t;
var foo_r2 = x > t;
var foo_r3... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithOneOperandIsUndefined.ts | TypeScript | var x: typeof undefined;
enum E { a, b, c }
function foo<T>(t: T) {
var foo_r1 = t < x;
var foo_r2 = t > x;
var foo_r3 = t <= x;
var foo_r4 = t >= x;
var foo_r5 = t == x;
var foo_r6 = t != x;
var foo_r7 = t === x;
var foo_r8 = t !== x;
var foo_r1 = x < t;
var foo_r2 = x > t;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeEnumAndNumber.ts | TypeScript | enum E { a, b, c }
var a: E;
var b: number;
// operator <
var ra1 = a < b;
var ra2 = b < a;
var ra3 = E.a < b;
var ra4 = b < E.a;
var ra5 = E.a < 0;
var ra6 = 0 < E.a;
// operator >
var rb1 = a > b;
var rb2 = b > a;
var rb3 = E.a > b;
var rb4 = b > E.a;
var rb5 = E.a > 0;
var rb6 = 0 > E.a;
// operator <=
var rc1 =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnCallSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
var a1: { fn(): void };
var b1: { fn(): void };
var a2: { fn(a: number, b: string): void };
var b2: { fn(a: number, b: string): void };
var a3: { fn(a: number, b: string): void };
var b3: { fn(a: number): void };
var a4: { fn... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnConstructorSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
var a1: { new (): Base };
var b1: { new (): Base };
var a2: { new (a: number, b: string): Base };
var b2: { new (a: number, b: string): Base };
var a3: { new (a: number, b: string): Base };
var b3: { new (a: number): Base };
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnIndexSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
var a1: { [a: string]: string };
var b1: { [b: string]: string };
var a2: { [index: string]: Base };
var b2: { [index: string]: Derived };
var a3: { [index: number]: string };
var b3: { [index: number]: string };
var a4: { [i... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
var a1: { fn<T>(x: T): T };
var b1: { fn(x: string): string };
var a2: { fn<T>(x: T): T };
var b2: { fn(x: string, y: number): string };
var a3: { fn<T, U>(x: T, y: U): T };
var b3: { fn(x: string, y: number): string };
var a... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
var a1: { new <T>(x: T): T };
var b1: { new (x: string): string };
var a2: { new <T>(x: T): T };
var b2: { new (x: string, y: number): string };
var a3: { new <T, U>(x: T, y: U): T };
var b3: { new (x: string, y: number): stri... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts | TypeScript | interface I {
a: string;
b?: number;
}
interface J {
a: string;
}
var a: I;
var b: J;
// operator <
var ra1 = a < b;
var ra2 = b < a;
// operator >
var rb1 = a > b;
var rb2 = b > a;
// operator <=
var rc1 = a <= b;
var rc2 = b <= a;
// operator >=
var rd1 = a >= b;
var rd2 = b >= a;
// operator ==
va... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithSubtypeObjectOnProperty.ts | TypeScript | class Base {
public a: string;
}
class Derived extends Base {
public b: string;
}
class A1 {
public a: Base;
public b: Base;
}
class B1 {
public a: Base;
public b: Derived;
}
class A2 {
private a;
}
class B2 extends A2 {
private b;
}
var a1: A1;
var a2: A2;
var b1: B1;
var b2: B2;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithTwoOperandsAreAny.ts | TypeScript | var a: any;
var r1 = a < a;
var r2 = a > a;
var r3 = a <= a;
var r4 = a >= a;
var r5 = a == a;
var r6 = a != a;
var r7 = a === a;
var r8 = a !== a; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/comparisonOperatorWithTypeParameter.ts | TypeScript | var a: {};
var b: Object;
function foo<T, U/* extends T*/, V/* extends U*/>(t: T, u: U, v: V) {
// errors
var ra1 = t < u;
var ra2 = t > u;
var ra3 = t <= u;
var ra4 = t >= u;
var ra5 = t == u;
var ra6 = t != u;
var ra7 = t === u;
var ra8 = t !== u;
var rb1 = u < t;
var rb2... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.