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/decrementOperatorWithUnsupportedStringType.ts
TypeScript
// -- operator on string type var STRING: string; var STRING1: string[] = ["", ""]; function foo(): string { return ""; } class A { public a: string; static foo() { return ""; } } module M { export var n: string; } var objA = new A(); // string type var var ResultIsNumber1 = --STRING; var ResultIsNumber...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportInAwaitExpression01.ts
TypeScript
// @target: ES6 // @module: umd // @filename: a.ts const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); export default x; // @filename: b.ts import x from './a'; ( async function() { const value = await x; }() );
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportInAwaitExpression02.ts
TypeScript
// @target: ES6 // @module: commonjs // @filename: a.ts const x = new Promise( ( resolve, reject ) => { resolve( {} ); } ); export default x; // @filename: b.ts import x from './a'; ( async function() { const value = await x; }() );
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportWithOverloads01.ts
TypeScript
// @module: commonjs // @target: ES5 export default function f(); export default function f(x: string); export default function f(...args: any[]) { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsCannotMerge01.ts
TypeScript
// @module: commonjs // @target: ES5 // @filename: m1.ts export default function Decl() { return 0; } export interface Decl { p1: number; p2: number; } export namespace Decl { export var x = 10; export var y = 20; interface I { } } // @filename: m2.ts import Entity from "m1" Entity(); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsCannotMerge02.ts
TypeScript
// @module: commonjs // @target: ES5 // @filename: m1.ts export default class Decl { } export interface Decl { p1: number; p2: number; } export namespace Decl { interface I { } } // @filename: m2.ts import Entity from "m1" Entity(); var x: Entity; var y: Entity.I; var z = new Entity(); var sum = z...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsCannotMerge03.ts
TypeScript
// @module: commonjs // @target: ES5 // @filename: m1.ts export default class Decl { } interface Decl { p1: number; p2: number; } namespace Decl { interface I { } } // @filename: m2.ts import Entity from "m1" Entity(); var x: Entity; var y: Entity.I; var z = new Entity(); var sum = z.p1 + z.p2
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsCannotMerge04.ts
TypeScript
// @module: commonjs // @target: ES5 export default function Foo() { } namespace Foo { export var x; } interface Foo { } export interface Foo { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsGetExportedAmd.ts
TypeScript
// @target: ES6 // @module: amd // @filename: a.ts export default class Foo {} // @filename: b.ts export default function foo() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsGetExportedCommonjs.ts
TypeScript
// @target: ES6 // @module: commonjs // @filename: a.ts export default class Foo {} // @filename: b.ts export default function foo() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsGetExportedSystem.ts
TypeScript
// @target: ES6 // @module: system // @filename: a.ts export default class Foo {} // @filename: b.ts export default function foo() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultExportsGetExportedUmd.ts
TypeScript
// @target: ES6 // @module: umd // @filename: a.ts export default class Foo {} // @filename: b.ts export default function foo() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defaultPropertyAssignedClassWithPrototype.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: bug39167.js var test = {}; test.K = test.K || function () {} test.K.prototype = { add() {} }; new test.K().add;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/defineProperty.ts
TypeScript
// @target: es5, esnext // @useDefineForClassFields: true var x: "p" = "p" class A { a = this.y b public c; ["computed"] = 13 ;[x] = 14 m() { } constructor(public readonly y: number) { } z = this.y declare notEmitted; } class B { public a; } class C extends B { declare public...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteChain.ts
TypeScript
// @strict: true declare const o1: undefined | { b: string }; delete o1?.b; delete (o1?.b); declare const o2: undefined | { b: { c: string } }; delete o2?.b.c; delete (o2?.b.c); declare const o3: { b: undefined | { c: string } }; delete o3.b?.c; delete (o3.b?.c); declare const o4: { b?: { c: { d?: { e: string } } }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteOperatorWithAnyOtherType.ts
TypeScript
// delete operator on any type var ANY: any; var ANY1; var ANY2: any[] = ["", ""]; var obj: () => {}; var obj1 = { x: "", y: () => { }}; function foo(): any { var a; return a; } class A { public a: any; static foo() { var a; return a; } } module M { export var n: any; } var obj...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteOperatorWithBooleanType.ts
TypeScript
// delete operator on boolean type var BOOLEAN: boolean; function foo(): boolean { return true; } class A { public a: boolean; static foo() { return false; } } module M { export var n: boolean; } var objA = new A(); // boolean type var var ResultIsBoolean1 = delete BOOLEAN; // boolean type literal var...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteOperatorWithEnumType.ts
TypeScript
// delete operator on enum type enum ENUM { }; enum ENUM1 { A, B, "" }; // enum type var var ResultIsBoolean1 = delete ENUM; var ResultIsBoolean2 = delete ENUM1; // enum type expressions var ResultIsBoolean3 = delete ENUM1["A"]; var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); // multiple delete operators va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteOperatorWithNumberType.ts
TypeScript
// delete operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; function foo(): number { return 1; } class A { public a: number; static foo() { return 1; } } module M { export var n: number; } var objA = new A(); // number type var var ResultIsBoolean1 = delete NUMBER; var ResultI...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/deleteOperatorWithStringType.ts
TypeScript
// delete operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; function foo(): string { return "abc"; } class A { public a: string; static foo() { return ""; } } module M { export var n: string; } var objA = new A(); // string type var var ResultIsBoolean1 = delete STRING; v...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/dependentDestructuredVariables.ts
TypeScript
// @strict: true // @declaration: true // @target: es2015 // @lib: esnext, dom type Action = | { kind: 'A', payload: number } | { kind: 'B', payload: string }; function f10({ kind, payload }: Action) { if (kind === 'A') { payload.toFixed(); } if (kind === 'B') { payload.toUpperCase...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/dependentDestructuredVariablesFromNestedPatterns.ts
TypeScript
// @strict: true // @target: esnext // @lib: esnext // @noEmit: true function test1(arg: [[undefined, Error] | [number, undefined]]) { const [[p1, p1Error]] = arg; if (p1Error) { return; } p1; } function test2([[p1, p1Error]]: [[undefined, Error] | [number, undefined]]) { if (p1Error) { return; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassConstructorWithoutSuperCall.ts
TypeScript
// derived class constructors must contain a super call class Base { x: string; } class Derived extends Base { constructor() { // error } } class Base2<T> { x: T; } class Derived2<T> extends Base2<T> { constructor() { // error for no super call (nested scopes don't count) var r2 = () => ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassFunctionOverridesBaseClassAccessor.ts
TypeScript
class Base { get x() { return 1; } set x(v) { } } // error class Derived extends Base { x() { return 1; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassIncludesInheritedMembers.ts
TypeScript
class Base { a: string; b() { } get c() { return ''; } set c(v) { } static r: string; static s() { } static get t() { return ''; } static set t(v) { } constructor(x) { } } class Derived extends Base { } var d: Derived = new Derived(1); var r1 = d.a; var r2 = d.b(); var r3 = d.c; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesIndexersWithAssignmentCompatibility.ts
TypeScript
class Base { [x: string]: Object; } // ok, use assignment compatibility class Derived extends Base { [x: string]: any; } class Base2 { [x: number]: Object; } // ok, use assignment compatibility class Derived2 extends Base2 { [x: number]: any; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesPrivates.ts
TypeScript
class Base { private x: { foo: string }; } class Derived extends Base { private x: { foo: string; bar: string; }; // error } class Base2 { private static y: { foo: string }; } class Derived2 extends Base2 { private static y: { foo: string; bar: string; }; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesProtectedMembers.ts
TypeScript
// @target: ES5 var x: { foo: string; } var y: { foo: string; bar: string; } class Base { protected a: typeof x; protected b(a: typeof x) { } protected get c() { return x; } protected set c(v: typeof x) { } protected d: (a: typeof x) => void; protected static r: typeof x; protected static...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesProtectedMembers2.ts
TypeScript
// @target: ES5 var x: { foo: string; } var y: { foo: string; bar: string; } class Base { protected a: typeof x; protected b(a: typeof x) { } protected get c() { return x; } protected set c(v: typeof x) { } protected d: (a: typeof x) => void ; protected static r: typeof x; protected static...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesProtectedMembers3.ts
TypeScript
// @target: ES5 var x: { foo: string; } var y: { foo: string; bar: string; } class Base { a: typeof x; b(a: typeof x) { } get c() { return x; } set c(v: typeof x) { } d: (a: typeof x) => void; static r: typeof x; static s(a: typeof x) { } static get t() { return x; } static set t(...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesProtectedMembers4.ts
TypeScript
var x: { foo: string; } var y: { foo: string; bar: string; } class Base { protected a: typeof x; } class Derived1 extends Base { public a: typeof x; } class Derived2 extends Derived1 { protected a: typeof x; // Error, parent was public }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesPublicMembers.ts
TypeScript
var x: { foo: string; } var y: { foo: string; bar: string; } class Base { a: typeof x; b(a: typeof x) { } get c() { return x; } set c(v: typeof x) { } d: (a: typeof x) => void; static r: typeof x; static s(a: typeof x) { } static get t() { return x; } static set t(v: typeof x) { } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassOverridesWithoutSubtype.ts
TypeScript
class Base { x: { foo: string; } } class Derived extends Base { x: { foo: any; } } class Base2 { static y: { foo: string; } } class Derived2 extends Base2 { static y: { foo: any; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassTransitivity.ts
TypeScript
// subclassing is not transitive when you can remove required parameters and add optional parameters class C { foo(x: number) { } } class D extends C { foo() { } // ok to drop parameters } class E extends D { foo(x?: string) { } // ok to add optional parameters } var c: C; var d: D; var e: E; c = e; var...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassTransitivity2.ts
TypeScript
// subclassing is not transitive when you can remove required parameters and add optional parameters class C { foo(x: number, y: number) { } } class D extends C { foo(x: number) { } // ok to drop parameters } class E extends D { foo(x: number, y?: string) { } // ok to add optional parameters } var c: C;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassTransitivity3.ts
TypeScript
// subclassing is not transitive when you can remove required parameters and add optional parameters class C<T> { foo(x: T, y: T) { } } class D<T> extends C<T> { foo(x: T) { } // ok to drop parameters } class E<T> extends D<T> { foo(x: T, y?: number) { } // ok to add optional parameters } var c: C<strin...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassTransitivity4.ts
TypeScript
// subclassing is not transitive when you can remove required parameters and add optional parameters on protected members class C { protected foo(x: number) { } } class D extends C { protected foo() { } // ok to drop parameters } class E extends D { public foo(x?: string) { } // ok to add optional parame...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithAny.ts
TypeScript
class C { x: number; get X(): number { return 1; } foo(): number { return 1; } static y: number; static get Y(): number { return 1; } static bar(): number { return 1; } } class D extends C { x: any; get X(): any { return null; } foo()...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithPrivateInstanceShadowingProtectedInstance.ts
TypeScript
// @target: ES5 class Base { protected x: string; protected fn(): string { return ''; } protected get a() { return 1; } protected set a(v) { } } // error, not a subtype class Derived extends Base { private x: string; private fn(): string { return ''; } private ge...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithPrivateInstanceShadowingPublicInstance.ts
TypeScript
class Base { public x: string; public fn(): string { return ''; } public get a() { return 1; } public set a(v) { } } // error, not a subtype class Derived extends Base { private x: string; private fn(): string { return ''; } private get a() { return 1; } priva...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithPrivateStaticShadowingProtectedStatic.ts
TypeScript
// @target: ES5 class Base { protected static x: string; protected static fn(): string { return ''; } protected static get a() { return 1; } protected static set a(v) { } } // should be error class Derived extends Base { private static x: string; private static fn(): string { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithPrivateStaticShadowingPublicStatic.ts
TypeScript
class Base { public static x: string; public static fn(): string { return ''; } public static get a() { return 1; } public static set a(v) { } } // BUG 847404 // should be error class Derived extends Base { private static x: string; private static fn(): string { return '';...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithoutExplicitConstructor.ts
TypeScript
class Base { a = 1; constructor(x: number) { this.a = x; } } class Derived extends Base { x = 1 y = 'hello'; } var r = new Derived(); // error var r2 = new Derived(1); class Base2<T> { a: T; constructor(x: T) { this.a = x; } } class D<T extends Date> extends Base2<T> { x = 2 y: T = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithoutExplicitConstructor2.ts
TypeScript
class Base { a = 1; constructor(x: number, y?: number, z?: number); constructor(x: number, y?: number); constructor(x: number) { this.a = x; } } class Derived extends Base { x = 1 y = 'hello'; } var r = new Derived(); // error var r2 = new Derived(1); var r3 = new Derived(1, 2); var r4 = new ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedClassWithoutExplicitConstructor3.ts
TypeScript
// automatic constructors with a class hieararchy of depth > 2 class Base { a = 1; constructor(x: number) { this.a = x; } } class Derived extends Base { b = ''; constructor(y: string, z: string) { super(2); this.b = y; } } class Derived2 extends Derived { x = 1 y = 'hello'...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedGenericClassWithAny.ts
TypeScript
class C<T extends number> { x: T; get X(): T { return null; } foo(): T { return null; } } class D extends C<number> { x: any; get X(): any { return null; } foo(): any { return 1; } static y: any; static get Y(): any { return null; } s...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedInterfaceDoesNotHideBaseSignatures.ts
TypeScript
// Derived interfaces no longer hide signatures from base types, so these signatures are always compatible. interface Base { (): string; new (x: string): number; } interface Derived extends Base { (): number; new (x: string): string; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedInterfaceIncompatibleWithBaseIndexer.ts
TypeScript
interface Base { [x: number]: { x: number; y: number; }; [x: string]: { x: number; } } interface Derived extends Base { 1: { y: number } // error } interface Derived2 extends Base { '1': { y: number } // error } interface Derived3 extends Base { foo: { y: number } // error } interface Derived4 e...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.ts
TypeScript
class Base { foo(x: { a: number }): { a: number } { return null; } } class Derived extends Base { foo(x: { a: number; b: number }): { a: number; b: number } { return null; } bar() { var r = super.foo({ a: 1 }); // { a: number } var r2 = super.foo({ a: 1, b: 2 }); //...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/derivedTypeDoesNotRequireExtendsClause.ts
TypeScript
class Base { foo: string; } class Derived { foo: string; bar: number; } class Derived2 extends Base { bar: string; } var b: Base; var d1: Derived; var d2: Derived2; b = d1; b = d2; var r: Base[] = [d1, d2];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment1ES5.ts
TypeScript
/* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern * ArrayAssignmentPattern: * [Elision<opt> AssignmentRestElementopt ] * [AssignmentElementList] * [AssignmentElementList, Elision<opt> AssignmentRestElementopt ] * AssignmentElementList: * Elision<opt>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment1ES5iterable.ts
TypeScript
// @downlevelIteration: true /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern * ArrayAssignmentPattern: * [Elision<opt> AssignmentRestElementopt ] * [AssignmentElementList] * [AssignmentElementList, Elision<opt> AssignmentRestElementopt ] * AssignmentElem...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment1ES6.ts
TypeScript
// @target: es6 /* AssignmentPattern: * ObjectAssignmentPattern * ArrayAssignmentPattern * ArrayAssignmentPattern: * [Elision<opt> AssignmentRestElementopt ] * [AssignmentElementList] * [AssignmentElementList, Elision<opt> AssignmentRestElementopt ] * AssignmentElementList: * ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment2.ts
TypeScript
// V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is the type Any, or var [[a0], [[a1]]] = [] // Error var [[a2], [[a3]]] = undefined // Error // V is an array assignment pattern, S is the type Any or an array-like...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment3.ts
TypeScript
const [a, b = a] = [1]; // ok const [c, d = c, e = e] = [1]; // error for e = e const [f, g = f, h = i, i = f] = [1]; // error for h = i (function ([a, b = a]) { // ok })([1]); (function ([c, d = c, e = e]) { // error for e = e })([1]); (function ([f, g = f, h = i, i = f]) { // error for h = i })([1])
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment4.ts
TypeScript
// #35497 // @target: es5 // @downlevelIteration: true // @lib: es6 // @strict: true declare const data: number[] | null; const [value] = data; // Error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringArrayBindingPatternAndAssignment5SiblingInitializer.ts
TypeScript
// @noImplicitAny: true // To be inferred as `number` function f1() { const [a1, b1 = a1] = [1]; const [a2, b2 = 1 + a2] = [1]; } // To be inferred as `string` function f2() { const [a1, b1 = a1] = ['hi']; const [a2, b2 = a2 + '!'] = ['hi']; } // To be inferred as `string | number` function f3() { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringAssignabilityCheck.ts
TypeScript
// @strict: true const [] = {}; // should be error const {} = undefined; // error correctly (([]) => 0)({}); // should be error (({}) => 0)(undefined); // should be error function foo({}: undefined) { return 0 } function bar([]: {}) { return 0 } const { }: undefined = 1 const []: {} = {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringCatch.ts
TypeScript
// @noImplicitAny: true try { throw [0, 1]; } catch ([a, b]) { a + b; } try { throw { a: 0, b: 1 }; } catch ({a, b}) { a + b; } try { throw [{ x: [0], z: 1 }]; } catch ([{x: [y], z}]) { y + z; } // Test of comment ranges. A fix to GH#11755 should update this. try { } catch (/*Test comment ra...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringControlFlow.ts
TypeScript
// @strict: true function f1(obj: { a?: string }) { if (obj.a) { obj = {}; let a1 = obj["a"]; // string | undefined let a2 = obj.a; // string | undefined } } function f2(obj: [number, string] | null[]) { let a0 = obj[0]; // number | null let a1 = obj[1]; // string | null ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringEvaluationOrder.ts
TypeScript
// @target: es5,es2015 // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/39205 let trace: any[] = []; let order = (n: any): any => trace.push(n); // order(0) should evaluate before order(1) because the first element is undefined let [{ [order(1)]: x } = order(0)] = []; // order(0) should ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringInFunctionType.ts
TypeScript
// @declaration: true interface a { a } interface b { b } interface c { c } type T1 = ([a, b, c]); type F1 = ([a, b, c]) => void; type T2 = ({ a }); type F2 = ({ a }) => void; type T3 = ([{ a: b }, { b: a }]); type F3 = ([{ a: b }, { b: a }]) => void; type T4 = ([{ a: [b, c] }]); type F4 = ([{ a: [b, c] }]) => voi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectAssignmentPatternWithNestedSpread.ts
TypeScript
// @target: es5, es2015, es2018 // @noTypesAndSymbols: true let a: any, b: any, c: any = {x: {a: 1, y: 2}}, d: any; ({x: {a, ...b} = d} = c);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment1ES5.ts
TypeScript
// In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an object assignment pattern and, for each assignment prop...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment1ES6.ts
TypeScript
// @target: es6 // In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. // An expression of type S is considered assignable to an assignment target V if one of the following is true // V is an object assignment pattern and, for each...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment4.ts
TypeScript
const { a = 1, b = 2, c = b, // ok d = a, // ok e = f, // error f = f // error } = { } as any;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment5.ts
TypeScript
function a () { let x: number; let y: any ({ x, ...y } = ({ } as any)); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment6.ts
TypeScript
// @target: es5,esnext const a = "a"; const b = "b"; const { [a]: aVal, [b]: bVal } = (() => { return { [a]: 1, [b]: 1 }; })(); console.log(aVal, bVal);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment7.ts
TypeScript
// @target: es5,esnext enum K { a = "a", b = "b" } const { [K.a]: aVal, [K.b]: bVal } = (() => { return { [K.a]: 1, [K.b]: 1 }; })(); console.log(aVal, bVal);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment8.ts
TypeScript
// @target: es5,esnext const K = { a: "a", b: "b" } const { [K.a]: aVal, [K.b]: bVal } = (() => { return { [K.a]: 1, [K.b]: 1 }; })(); console.log(aVal, bVal);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringObjectBindingPatternAndAssignment9SiblingInitializer.ts
TypeScript
// @noImplicitAny: true // To be inferred as `number` function f1() { const { a1, b1 = a1 } = { a1: 1 }; const { a2, b2 = 1 + a2 } = { a2: 1 }; } // To be inferred as `string` function f2() { const { a1, b1 = a1 } = { a1: 'hi' }; const { a2, b2 = a2 + '!' } = { a2: 'hi' }; } // To be inferred as `str...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration1ES5.ts
TypeScript
// A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotation, the parameter is of that type function a1([a...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration1ES5iterable.ts
TypeScript
// @downlevelIteration: true // A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotation, the parameter i...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration1ES6.ts
TypeScript
// Conformance for emitting ES6 // @target: es6 // A parameter declaration may specify either an identifier or a binding pattern. // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. // If the declaration includes a type annotat...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration3ES5.ts
TypeScript
// @target: es6 // If the parameter is a rest parameter, the parameter type is any[] // A type annotation for a rest parameter must denote an array type. // RestParameter: // ... Identifier TypeAnnotation(opt) type arrayString = Array<String> type someArray = Array<String> | number[]; type stringOrNumArray ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration3ES5iterable.ts
TypeScript
// @target: es5 // @downlevelIteration: true // If the parameter is a rest parameter, the parameter type is any[] // A type annotation for a rest parameter must denote an array type. // RestParameter: // ... Identifier TypeAnnotation(opt) type arrayString = Array<String> type someArray = Array<String> | num...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration3ES6.ts
TypeScript
// @target: es6 // If the parameter is a rest parameter, the parameter type is any[] // A type annotation for a rest parameter must denote an array type. // RestParameter: // ... Identifier TypeAnnotation(opt) type arrayString = Array<String> type someArray = Array<String> | number[]; type stringOrNumArray ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration5.ts
TypeScript
// Parameter Declaration with generic interface F { } class Class implements F { constructor() { } } class SubClass extends Class { foo: boolean; constructor() { super(); } } class D implements F { foo: boolean constructor() { } } class SubD extends D { bar: number constructor() { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration7ES5.ts
TypeScript
// @target: es5 interface ISomething { foo: string, bar: string } function foo({}, {foo, bar}: ISomething) {} function baz([], {foo, bar}: ISomething) {} function one([], {}) {} function two([], [a, b, c]: number[]) {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration7ES5iterable.ts
TypeScript
// @target: es5 // @downlevelIteration: true interface ISomething { foo: string, bar: string } function foo({}, {foo, bar}: ISomething) {} function baz([], {foo, bar}: ISomething) {} function one([], {}) {} function two([], [a, b, c]: number[]) {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringParameterDeclaration8.ts
TypeScript
// explicit type annotation should cause `method` to have type 'x' | 'y' // both inside and outside `test`. function test({ method = 'z', nested: { p = 'c' } }: { method?: 'x' | 'y', nested?: { p: 'a' | 'b' } }) { method p } test({}); test({ method: 'x', nested: { p: 'a' } }) test({ method: 'z'...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringReassignsRightHandSide.ts
TypeScript
// @target: es5 var foo: any = { foo: 1, bar: 2 }; var bar: any; // reassignment in destructuring pattern ({ foo, bar } = foo); // reassignment in subsequent var var { foo, baz } = foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringSameNames.ts
TypeScript
// Valid cases let { foo, foo: bar } = { foo: 1 }; ({ foo, foo } = { foo: 2 }); ({ foo, foo: bar } = { foo: 3 }); ({ foo: bar, foo } = { foo: 4 }); ({ foo, bar: foo } = { foo: 3, bar: 33 }); ({ bar: foo, foo } = { foo: 4, bar: 44 }); ({ foo: bar, foo: bar } = { foo: 5 }); ({ foo: bar, bar: foo } = { foo: 6, bar: 66 })...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringSpread.ts
TypeScript
const { x } = { ...{}, x: 0 }; const { y } = { y: 0, ...{} }; const { z, a, b } = { z: 0, ...{ a: 0, b: 0 } }; const { c, d, e, f, g } = { ...{ ...{ ...{ c: 0, }, d: 0 }, e: 0 }, f: 0 };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_1.ts
TypeScript
//@target: ES5 var { x } = <any>foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_2.ts
TypeScript
//@target: ES5 var { x } = (<any>foo());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_3.ts
TypeScript
//@target: ES5 var { x } = <any>(foo());
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_4.ts
TypeScript
//@target: ES5 var { x } = <any><any>foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_5.ts
TypeScript
//@target: ES5 var { x } = <any>0;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_6.ts
TypeScript
//@target: ES5 var { x } = <any>new Foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringTypeAssertionsES5_7.ts
TypeScript
//@target: ES5 var { x } = <any><any>new Foo;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVariableDeclaration1ES5.ts
TypeScript
// The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true]; // The ty...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVariableDeclaration1ES5iterable.ts
TypeScript
// @downlevelIteration: true // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVariableDeclaration1ES6.ts
TypeScript
// @target: es6 // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: 10, a2: "world" } var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVariableDeclaration2.ts
TypeScript
// The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. var {a1, a2}: { a1: number, a2: string } = { a1: true, a2: 1 } // Error var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [[false]], ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVoid.ts
TypeScript
// @strictNullChecks: false declare const v: void; const {} = v;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringVoidStrictNullChecks.ts
TypeScript
// @strictNullChecks: true declare const v: void; const {} = v;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringWithLiteralInitializers.ts
TypeScript
// (arg: { x: any, y: any }) => void function f1({ x, y }) { } f1({ x: 1, y: 1 }); // (arg: { x: any, y?: number }) => void function f2({ x, y = 0 }) { } f2({ x: 1 }); f2({ x: 1, y: 1 }); // (arg: { x?: number, y?: number }) => void function f3({ x = 0, y = 0 }) { } f3({}); f3({ x: 1 }); f3({ y: 1 }); f3({ x: 1, y: 1...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/destructuringWithLiteralInitializers2.ts
TypeScript
// @strict: true function f00([x, y]) {} function f01([x, y] = []) {} function f02([x, y] = [1]) {} function f03([x, y] = [1, 'foo']) {} function f10([x = 0, y]) {} function f11([x = 0, y] = []) {} function f12([x = 0, y] = [1]) {} function f13([x = 0, y] = [1, 'foo']) {} function f20([x = 0, y = 'bar']) {} function...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/directDependenceBetweenTypeAliases.ts
TypeScript
// It is an error for the type specified in a type alias to depend on that type alias // A type alias directly depends on the type it aliases. type T0 = T0 type T0_1 = T0_2 type T0_2 = T0_3 type T0_3 = T0_1 // A type reference directly depends on the referenced type and each of the type arguments, if any. interface I...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University