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/awaitUsingDeclarations.3.ts
TypeScript
// @target: esnext,es2022,es2017,es2015,es5 // @module: esnext // @lib: esnext // @noTypesAndSymbols: true { await using d1 = { async [Symbol.asyncDispose]() {} }, d2 = null, d3 = undefined, d4 = { [Symbol.dispose]() {} }; } export {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarations.9.ts
TypeScript
// @target: esnext // @module: esnext // @lib: es2022 // @noTypesAndSymbols: true { await using a = null; } export {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInFor.ts
TypeScript
// @target: esnext,es2022,es2017,es2015,es5 // @module: esnext // @lib: esnext // @noTypesAndSymbols: true async function main() { for (await using d1 = { [Symbol.dispose]() {} }, d2 = { async [Symbol.asyncDispose]() {} }, d3 = null, d4 = undefined;;) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInForAwaitOf.2.ts
TypeScript
// @target: esnext // @module: esnext // @lib: esnext // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/55555 async function test() { for await (await using of of of) {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInForAwaitOf.ts
TypeScript
// @target: esnext,es2022,es2017,es2015,es5 // @module: esnext // @lib: esnext // @noTypesAndSymbols: true async function main() { for await (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInForOf.1.ts
TypeScript
// @target: esnext,es2022,es2017,es2015,es5 // @module: esnext // @lib: esnext // @noTypesAndSymbols: true async function main() { for (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInForOf.2.ts
TypeScript
// @target: esnext // @module: esnext // @lib: esnext // @noTypesAndSymbols: true async function main() { for (await using of of []) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsInForOf.4.ts
TypeScript
// @target: esnext // @module: esnext // @lib: esnext // @noTypesAndSymbols: true // https://github.com/microsoft/TypeScript/issues/55555 { for (await using of of of) {}; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsTopLevelOfModule.1.ts
TypeScript
// @target: es2022 // @lib: esnext,dom // @module: system,esnext // @noTypesAndSymbols: true // @noEmitHelpers: true export const x = 1; export { y }; await using z = { async [Symbol.asyncDispose]() {} }; const y = 2; export const w = 3; export default 4; console.log(w, x, y, z);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/awaitUsingDeclarationsWithImportHelpers.ts
TypeScript
// @target: es2022 // @module: esnext // @lib: esnext // @importHelpers: true // @noTypesAndSymbols: true export {}; async function f() { await using a = null; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es2017.ts
TypeScript
// @target: es2017 async function bar() { !await 42; // OK } async function bar1() { +await 42; // OK } async function bar3() { -await 42; // OK } async function bar4() { ~await 42; // OK }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es2017_1.ts
TypeScript
// @target: es2017 async function bar() { !await 42; // OK } async function bar1() { delete await 42; // OK } async function bar2() { delete await 42; // OK } async function bar3() { void await 42; } async function bar4() { +await 42; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es2017_2.ts
TypeScript
// @target: es2017 async function bar1() { delete await 42; } async function bar2() { delete await 42; } async function bar3() { void await 42; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es6.ts
TypeScript
// @target: es6 async function bar() { !await 42; // OK } async function bar1() { +await 42; // OK } async function bar3() { -await 42; // OK } async function bar4() { ~await 42; // OK }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es6_1.ts
TypeScript
// @target: es6 async function bar() { !await 42; // OK } async function bar1() { delete await 42; // OK } async function bar2() { delete await 42; // OK } async function bar3() { void await 42; } async function bar4() { +await 42; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/await_unaryExpression_es6_2.ts
TypeScript
// @target: es6 async function bar1() { delete await 42; } async function bar2() { delete await 42; } async function bar3() { void await 42; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bestCommonTypeOfConditionalExpressions.ts
TypeScript
// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here var a: { x: number; y?: number }; var b: { x: number; z?: number }; class Base { foo: string; } class Derived extends Base { bar: string; } class De...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bestCommonTypeOfConditionalExpressions2.ts
TypeScript
// conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Base { baz: string; } var base: Base; var derived: Derived; v...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bestCommonTypeOfTuple.ts
TypeScript
function f1(x: number): string { return "foo"; } function f2(x: number): number { return 10; } function f3(x: number): boolean { return true; } enum E1 { one } enum E2 { two } var t1: [(x: number) => string, (x: number) => number]; var t2: [E1, E2]; var t3: [number, any]; var t4: [E1, E2, number]; // no error t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bestCommonTypeOfTuple2.ts
TypeScript
interface base { } interface base1 { i } class C implements base { c } class D implements base { d } class E implements base { e } class F extends C { f } class C1 implements base1 { i = "foo"; c } class D1 extends C1 { i = "bar"; d } var t1: [C, base]; var t2: [C, D]; var t3: [C1, D1]; var t4: [base1, C1]; var t5: ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bigintMissingES2019.ts
TypeScript
// @target: es2019 // @lib: dom,es2019 declare function test<A, B extends A>(): void; test<{t?: string}, object>(); test<{t?: string}, bigint>(); // no error when bigint is used even when ES2020 lib is not present
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bigintMissingES2020.ts
TypeScript
// @target: es2020 // @lib: dom,es2017 declare function test<A, B extends A>(): void; test<{t?: string}, object>(); test<{t?: string}, bigint>(); // no error when bigint is used even when ES2020 lib is not present
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bigintMissingESNext.ts
TypeScript
// @target: esnext // @lib: dom,es2017 declare function test<A, B extends A>(): void; test<{t?: string}, object>(); test<{t?: string}, bigint>(); // no error when bigint is used even when ES2020 lib is not present
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/binaryIntegerLiteral.ts
TypeScript
// @target: es5 var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; var bin4 = 0B11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/binaryIntegerLiteralES6.ts
TypeScript
// @target: es6 var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; var bin4 = 0B11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/binderUninitializedModuleExportsAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: loop.js var loop1 = loop2; var loop2 = loop1; module.exports = loop2;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bitwiseNotOperatorWithBooleanType.ts
TypeScript
// @allowUnreachableCode: true // ~ 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 ResultIsNumber1 = ~BOOLEAN; // boole...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bitwiseNotOperatorWithEnumType.ts
TypeScript
// @allowUnreachableCode: true // ~ operator on enum type enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = ~ENUM1; // enum type expressions var ResultIsNumber2 = ~ENUM1["A"]; var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]); // multiple ~ operators var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B); // m...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bitwiseNotOperatorWithNumberType.ts
TypeScript
// @allowUnreachableCode: true // ~ 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 ResultIsNumber1 = ~...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bitwiseNotOperatorWithStringType.ts
TypeScript
// @allowUnreachableCode: true // ~ 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 ResultIsN...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bivariantInferences.ts
TypeScript
// @strict: true // Repro from #27337 interface Array<T> { equalsShallow<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>): boolean; } declare const a: (string | number)[] | null[] | undefined[] | {}[]; declare const b: (string | number)[] | null[] | undefined[] | {}[]; let x = a.equalsShallow(b);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/boolInsteadOfBoolean.ts
TypeScript
var x: bool; var a: boolean = x; x = a;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/booleanLiteralTypes1.ts
TypeScript
type A1 = true | false; type A2 = false | true; function f1() { var a: A1; var a: A2; var a: true | false; var a: false | true; } function f2(a: true | false, b: boolean) { a = b; b = a; } function f3(a: true | false, b: true | false) { var x = a || b; var x = a && b; var x = !a; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/booleanLiteralTypes2.ts
TypeScript
// @strictNullChecks: true type A1 = true | false; type A2 = false | true; function f1() { var a: A1; var a: A2; var a: true | false; var a: false | true; } function f2(a: true | false, b: boolean) { a = b; b = a; } function f3(a: true | false, b: true | false) { var x = a || b; var ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/booleanPropertyAccess.ts
TypeScript
var x = true; var a = x.toString(); var b = x['toString']();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/bundlerSyntaxRestrictions.ts
TypeScript
// @moduleResolution: bundler // @module: esnext, preserve // @checkJs: true // @allowJs: true // @outDir: out // @Filename: /node_modules/@types/node/index.d.ts declare var require: (...args: any[]) => any; // @Filename: /ambient.d.ts declare module "fs" { export function readFileSync(path: string, encoding?: st...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callChain.2.ts
TypeScript
// @strict: false declare const o1: undefined | (() => number); o1?.(); declare const o2: undefined | { b: () => number }; o2?.b(); declare const o3: { b: (() => { c: string }) | undefined }; o3.b?.().c;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callChain.3.ts
TypeScript
// @strict: true declare function absorb<T>(): T; declare const a: { m?<T>(obj: {x: T}): T } | undefined; const n1: number = a?.m?.({x: 12 }); // should be an error (`undefined` is not assignable to `number`) const n2: number = a?.m?.({x: absorb()}); // likewise const n3: number | undefined = a?.m?.({x: 12}); // shoul...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callChain.ts
TypeScript
// @strict: true declare const o1: undefined | ((...args: any[]) => number); o1?.(); o1?.(1); o1?.(...[1, 2]); o1?.(1, ...[2, 3], 4); declare const o2: undefined | { b: (...args: any[]) => number }; o2?.b(); o2?.b(1); o2?.b(...[1, 2]); o2?.b(1, ...[2, 3], 4); o2?.["b"](); o2?.["b"](1); o2?.["b"](...[1, 2]); o2?.["b"]...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callChainInference.ts
TypeScript
// @strict: true // Repro from #42404 interface Y { foo<T>(this: T, arg: keyof T): void; a: number; b: string; } declare const value: Y | undefined; if (value) { value?.foo("a"); } value?.foo("a");
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callChainWithSuper.ts
TypeScript
// @target: *,-es3 // @strict: true // @noTypesAndSymbols: true // GH#34952 class Base { method?() {} } class Derived extends Base { method1() { return super.method?.(); } method2() { return super["method"]?.(); } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callGenericFunctionWithIncorrectNumberOfTypeArguments.ts
TypeScript
// type parameter lists must exactly match type argument lists // all of these invocations are errors function f<T, U>(x: T, y: U): T { return null; } var r1 = f<number>(1, ''); var r1b = f<number, string, number>(1, ''); var f2 = <T, U>(x: T, y: U): T => { return null; } var r2 = f2<number>(1, ''); var r2b = f2<numb...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callGenericFunctionWithZeroTypeArguments.ts
TypeScript
// valid invocations of generic functions with no explicit type arguments provided function f<T>(x: T): T { return null; } var r = f(1); var f2 = <T>(x: T): T => { return null; } var r2 = f2(1); var f3: { <T>(x: T): T; } var r3 = f3(1); class C { f<T>(x: T): T { return null; } } var r4 = (new C())....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callNonGenericFunctionWithTypeArguments.ts
TypeScript
// it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal function f(x: number) { return null; } var r = f<string>(1); var f2 = (x: number) => { return null; } var r2 = f2<string>(1); var f3: { (x: number): any; } var r3 = f3<string>(1); class C { f(x: numbe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callOfPropertylessConstructorFunction.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: callOfPropertylessConstructorFunction.js /** * @constructor */ function Dependency(j) { return j } Dependency({})
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callOverload.ts
TypeScript
declare function fn(x: any): void; declare function takeTwo(x: any, y: any): void; declare function withRest(a: any, ...args: Array<any>): void; var n: number[]; fn(1) // no error fn(1, 2, 3, 4) takeTwo(1, 2, 3, 4) withRest('a', ...n); // no error withRest(); withRest(...n);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance.ts
TypeScript
module CallSignature { interface Base { // T // M's (x: number): void; (x: number, y: number): void; } // S's interface I extends Base { // N's (x: number): number; // ok because base returns void (x: number, y: number): boolean; // ok because base return...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance2.ts
TypeScript
// checking subtype relations for function types as it relates to contextual signature instantiation class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } interface A { // T // M's a: (x: number...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance3.ts
TypeScript
// checking subtype relations for function types as it relates to contextual signature instantiation // error cases module Errors { class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance4.ts
TypeScript
// checking subtype relations for function types as it relates to contextual signature instantiation class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } class OtherDerived extends Base { bing: string; } interface A { // T // M's a: <T>(x: T) ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance5.ts
TypeScript
// checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: str...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureAssignabilityInInheritance6.ts
TypeScript
// checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Der...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureWithoutAnnotationsOrBody.ts
TypeScript
// Call signatures without a return type annotation and function body return 'any' function foo(x) { } var r = foo(1); // void since there's a body interface I { (); f(); } var i: I; var r2 = i(); var r3 = i.f(); var a: { (); f(); }; var r4 = a(); var r5 = a.f();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignatureWithoutReturnTypeAnnotationInference.ts
TypeScript
// @allowUnreachableCode: true // Call signatures without a return type should infer one from the function body (if present) // Simple types function foo(x) { return 1; } var r = foo(1); function foo2(x) { return foo(x); } var r2 = foo2(1); function foo3() { return foo3(); } var r3 = foo3(); function f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesThatDifferOnlyByReturnType.ts
TypeScript
// Each pair of signatures in these types has a signature that should cause an error. // Overloads, generic or not, that differ only by return type are an error. interface I { (x): number; (x): void; // error <T>(x: T): number; <T>(x: T): string; // error } interface I2 { <T>(x: T): number; <T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesThatDifferOnlyByReturnType2.ts
TypeScript
// Normally it is an error to have multiple overloads which differ only by return type in a single type declaration. // Here the multiple overloads come from multiple bases. interface I<T> { foo(x: number): T; } interface A extends I<number>, I<string> { } var x: A; // BUG 822524 var r = x.foo(1); // no error va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesThatDifferOnlyByReturnType3.ts
TypeScript
// Normally it is an error to have multiple overloads with identical signatures in a single type declaration. // Here the multiple overloads come from multiple merged declarations. interface I { (x: string): string; } interface I { (x: string): number; } interface I2<T> { (x: string): string; } interfac...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesWithAccessibilityModifiersOnParameters.ts
TypeScript
// Call signature parameters do not allow accessibility modifiers function foo(public x, private y) { } var f = function foo(public x, private y) { } var f2 = function (public x, private y) { } var f3 = (x, private y) => { } var f4 = <T>(public x: T, y: T) => { } function foo2(private x: string, public y: number) { }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesWithDuplicateParameters.ts
TypeScript
// Duplicate parameter names are always an error function foo(x, x) { } var f = function foo(x, x) { } var f2 = function (x, x) { } var f3 = (x, x) => { } var f4 = <T>(x: T, x: T) => { } function foo2(x: string, x: number) { } var f5 = function foo(x: string, x: number) { } var f6 = function (x: string, x: number) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesWithOptionalParameters.ts
TypeScript
// Optional parameters should be valid in all the below casts function foo(x?: number) { } var f = function foo(x?: number) { } var f2 = (x: number, y?: number) => { } foo(1); foo(); f(1); f(); f2(1); f2(1, 2); class C { foo(x?: number) { } } var c: C; c.foo(); c.foo(1); interface I { (x?: number); foo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesWithOptionalParameters2.ts
TypeScript
// Optional parameters should be valid in all the below casts function foo(x?: number); function foo(x?: number) { } foo(1); foo(); function foo2(x: number); function foo2(x: number, y?: number); function foo2(x: number, y?: number) { } foo2(1); foo2(1, 2); class C { foo(x?: number); foo(x?: number) { } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callSignaturesWithParameterInitializers.ts
TypeScript
// Optional parameters allow initializers only in implementation signatures function foo(x = 1) { } var f = function foo(x = 1) { } var f2 = (x: number, y = 1) => { } foo(1); foo(); f(1); f(); f2(1); f2(1, 2); class C { foo(x = 1) { } } var c: C; c.foo(); c.foo(1); // these are errors interface I { (x = 1)...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithMissingVoid.ts
TypeScript
// @strict: true // From #4260 class X<T> { f(t: T) { return { a: t }; } } declare const x: X<void>; x.f() // no error because f expects void declare const xUnion: X<void | number>; xUnion.f(42) // no error because f accepts number xUnion.f() // no error because f accepts void declare const xAny: X<...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithMissingVoidUndefinedUnknownAnyInJs.ts
TypeScript
// @strict: * // @checkJS: true // @allowJS: true // @noEmit: true // @filename: defs.d.ts declare function f1(p: void): void; declare function f2(p: undefined): void; declare function f3(p: unknown): void; declare function f4(p: any): void; interface I<T> { m(p: T): void; } declare const o1: I<void>; declare const o2...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpread.ts
TypeScript
interface X { foo(x: number, y: number, ...z: string[]): X; } function foo(x: number, y: number, ...z: string[]) { } var a: string[]; var z: number[]; var obj: X; var xa: X[]; foo(1, 2, "abc"); foo(1, 2, ...a); foo(1, 2, ...a, "abc"); obj.foo(1, 2, "abc"); obj.foo(1, 2, ...a); obj.foo(1, 2, ...a, "abc"); obj.f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpread2.ts
TypeScript
declare function all(a?: number, b?: number): void; declare function weird(a?: number | string, b?: number | string): void; declare function prefix(s: string, a?: number, b?: number): void; declare function rest(s: string, a?: number, b?: number, ...rest: number[]): void; declare function normal(s: string): void; decl...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpread3.ts
TypeScript
declare const s2: [string, string]; declare const s3: [string, string, string]; declare const s2_: [string, string, ...string[]]; declare const s_: string[]; declare const n_: number[]; declare const s2n_: [string, string, ...number[]]; declare function fs2(a: string, b: string): void; declare function fs2_(a: string,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpread4.ts
TypeScript
// @strict: true // @target: esnext type R = { a: number } type W = { b: number } type RW = { a: number, b: number } declare const pli: { (s1: R, s2: RW, s3: RW, s4: RW, s5: W): Promise<void>; (streams: ReadonlyArray<R | W | RW>): Promise<void>; (s1: R, s2: RW | W, ...streams: Array<RW | W>): Promise<void>;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpread5.ts
TypeScript
declare const x: number declare const nnnu: [number, number, number?] declare const nntnnnt: [number, number] | [number, number, number] declare function fn(a: number, b: number, bb: number, ...c: number[]): number fn(...nnnu, x) fn(...nntnnnt, x)
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callWithSpreadES6.ts
TypeScript
// @target: ES6 interface X { foo(x: number, y: number, ...z: string[]); } function foo(x: number, y: number, ...z: string[]) { } var a: string[]; var z: number[]; var obj: X; var xa: X[]; foo(1, 2, "abc"); foo(1, 2, ...a); foo(1, 2, ...a, "abc"); obj.foo(1, 2, "abc"); obj.foo(1, 2, ...a); obj.foo(1, 2, ...a, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackCrossModule.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod1.js /** @callback Con - some kind of continuation * @param {object | undefined} error * @return {any} I don't even know what this should return */ module.exports = C function C() { this.p = 1 } // @Filename: use.js /** @param {import('./mod1...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackOnConstructor.ts
TypeScript
// @filename: callbackOnConstructor.js // @checkJs: true // @outdir: dist // @declaration: true export class Preferences { assignability = "no" /** * @callback ValueGetter_2 * @param {string} name * @returns {boolean|number|string|undefined} */ constructor() {} } /** @type {ValueGetter_2} */ var oos...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTag1.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: cb.js /** @callback Sid * @param {string} s * @returns {string} What were you expecting */ var x = 1 /** @type {Sid} smallId */ var sid = s => s + "!"; /** @type {NoReturn} */ var noreturn = obj => void obj.title /** * @callback NoReturn * @pa...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTag2.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: cb.js /** @template T * @callback Id * @param {T} t * @returns {T} Maybe just return 120 and cast it? */ var x = 1 /** @type {Id<string>} I actually wanted to write `const "120"` */ var one_twenty = s => "120"; /** @template S * @callback Shared...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTag3.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: cb.js /** @callback Miracle * @returns {string} What were you expecting */ /** @type {Miracle} smallId */ var sid = () => "!";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTag4.ts
TypeScript
// @allowJs: true // @checkJs: true // @strict: true // @noEmit: true // @filename: ./a.js /** * @callback C * @this {{ a: string, b: number }} * @param {string} a * @param {number} b * @returns {boolean} */ /** @type {C} */ const cb = function (a, b) { this return true }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTagNamespace.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: namespaced.js /** * @callback NS.Nested.Inner * @param {Object} space - spaaaaaaaaace * @param {Object} peace - peaaaaaaaaace * @return {string | number} */ var x = 1; /** @type {NS.Nested.Inner} */ function f(space, peace) { return '1' }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTagNestedParameter.ts
TypeScript
// @emitDeclarationOnly: true // @declaration: true // @allowJs: true // @checkJs: true // @Filename: cb_nested.js /** * @callback WorksWithPeopleCallback * @param {Object} person * @param {string} person.name * @param {number} [person.age] * @returns {void} */ /** * For each person, calls your callback. * @pa...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/callbackTagVariadicType.ts
TypeScript
// @declaration: true // @outDir: bin/ // @checkJs: true // @Filename: callbackTagVariadicType.js /** * @callback Foo * @param {...string} args * @returns {number} */ /** @type {Foo} */ export const x = () => 1 var res = x('a', 'b')
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/castingTuple.ts
TypeScript
interface I { } class A { a = 10; } class C implements I { c }; class D implements I { d }; class E extends A { e }; class F extends A { f }; enum E1 { one } enum E2 { one } // no error var numStrTuple: [number, string] = [5, "foo"]; var emptyObjTuple = <[{}, {}]>numStrTuple; var numStrBoolTuple = <[number, string, b...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/chained.ts
TypeScript
// @Filename: /a.ts class A { a!: string } export type { A as B }; export type Z = A; // @Filename: /b.ts import { Z as Y } from './a'; export { B as C } from './a'; // @Filename: /c.ts import type { C } from './b'; export { C as D }; // @Filename: /d.ts import { D } from './c'; new D(); const d: D = {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/chained2.ts
TypeScript
// @Filename: /a.ts class A { a!: string } export type { A as default }; // @Filename: /b.ts import A from './a'; import type { default as B } from './a'; export { A, B }; // @Filename: /c.ts import * as types from './b'; export { types as default }; // @Filename: /d.ts import types from './c'; new types.A(); new ty...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/chainedPrototypeAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @noImplicitAny: true // @Filename: types.d.ts declare function require(name: string): any; declare var exports: any; // @Filename: mod.js /// <reference path='./types.d.ts'/> var A = function A() { this.a = 1 } var B = function B() { this.b = 2 } exports.A...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkExportsObjectAssignProperty.ts
TypeScript
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: mod1.js Object.defineProperty(exports, "thing", { value: 42, writable: true }); Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); Object.defineProperty(exports, "rwAccessors", { get() { return 98122 },...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkExportsObjectAssignPrototypeProperty.ts
TypeScript
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: mod1.js /** * @constructor * @param {string} name */ function Person(name) { this.name = name; } Person.prototype.describe = function () { return "Person called " + this.name; }; Object.defineProperty(Person.prototype, "thing...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocOnEndOfFile.ts
TypeScript
// @outFile: output.js // @allowJs: true // @checkJs: true // @Filename: eof.js /** * @typedef {Array<bad>} Should have error here */
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocOptionalParamOrder.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @param {number} a * @param {number} [b] * @param {number} c */ function foo(a, b, c) {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocParamOnVariableDeclaredFunctionExpression.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @param {number=} n * @param {string} [s] */ var x = function foo(n, s) {} var y; /** * @param {boolean!} b */ y = function bar(b) {} /** * @param {string} s */ var one = function (s) { }, two = function (untyped) { };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocParamTag1.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @param {number=} n * @param {string} [s] */ function foo(n, s) {} foo(); foo(1); foo(1, "hi");
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocReturnTag1.ts
TypeScript
// @allowJs: true // @outFile: dummy.js // @filename: returns.js // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return "hello"; } /** * @returns {string=} This comment is not currently exposed */ function f1() { return "hello world"; } /** * @returns {string...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocReturnTag2.ts
TypeScript
// @allowJs: true // @outFile: dummy.js // @filename: returns.js // @ts-check /** * @returns {string} This comment is not currently exposed */ function f() { return 5; } /** * @returns {string | number} This comment is not currently exposed */ function f1() { return 5 || true; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag1.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} T1 * @property {number} a */ /** * @typedef {Object} T2 * @property {"a" | "b"} a */ /** * @typedef {(x: string) => string} T3 */ /** * @typedef {Object} T4 * @property {string} a */ const t1 = /** @satisfi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag10.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {"a" | "b" | "c" | "d"} Keys */ const p = /** @satisfies {Partial<Record<Keys, unknown>>} */ ({ a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' }); // Should be OK -- retain info that a is number and b is st...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag11.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} T1 * @property {number} a */ /** * @typedef {Object} T2 * @property {number} a */ /** * @satisfies {T1} * @satisfies {T2} */ const t1 = { a: 1 }; /** * @satisfies {number} */ const t2 = /** @satisfies {number...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag12.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} T1 * @property {number} a */ /** * @typedef {Object} T2 * @property {string} a */ /** * @typedef {Object} T3 * @property {"a" | "b"} a */ /** * @satisfies {T1} */ const t1 = { a: 1 }; /** * @satisfies {T1} ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag13.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @satisfies {{ f: (x: string) => string }} */ const t1 = { f: s => s.toLowerCase() }; // should work /** @satisfies {{ f: (x: string) => string }} */ const t2 = { g: "oops" }; // should error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag14.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} T1 * @property {number} a */ /** * @satisfies T1 */ const t1 = { a: 1 }; const t2 = /** @satisfies T1 */ ({ a: 1 });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag2.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {Object.<string, (n: number) => boolean>} Predicates */ const p = /** @satisfies {Predicates} */ ({ isEven: n => n % 2 === 0, isOdd: n => n % 2 === 1 });
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag3.ts
TypeScript
// @strict: true // @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @type {{ f(s: string): void } & Record<string, unknown> }} */ let obj = /** @satisfies {{ g(s: string): void } & Record<string, unknown>} */ ({ f(s) { }, // "incorrect" implicit any on 's' g(s) { } }); // This needs ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag4.ts
TypeScript
// @noEmit: true // @module: esnext // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} Foo * @property {number} a */ export default /** @satisfies {Foo} */ ({}); // @filename: /b.js /** * @typedef {Object} Foo * @property {number} a */ export default /** @satisfies {Foo} */ ({ a: 1...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University