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/generatorTypeCheck7.ts
TypeScript
//@target: ES6 interface WeirdIter extends IterableIterator<number> { hello: string; } function* g1(): WeirdIter { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/generatorTypeCheck8.ts
TypeScript
//@target: ES6 interface BadGenerator extends Iterator<number>, Iterable<string> { } function* g3(): BadGenerator { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/generatorTypeCheck9.ts
TypeScript
//@target: ES6 function* g3(): void { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/generatorYieldContextualType.ts
TypeScript
// @target: esnext // @strict: true // @noEmit: true declare function f1<T, R, S>(gen: () => Generator<R, T, S>): void; f1<0, 0, 1>(function* () { const a = yield 0; return 0; }); declare function f2<T, R, S>(gen: () => Generator<R, T, S> | AsyncGenerator<R, T, S>): void; f2<0, 0, 1>(async function* () { const a = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/generic.ts
TypeScript
// @Filename: /a.ts export class A<T> { a!: T } export type { A as B }; // @Filename: /b.ts import type { A } from './a'; import { B } from './a'; let a: A<string> = { a: "" }; let b: B<number> = { a: 3 }; let c: A<boolean> = {}; let d: B = { a: "" };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericAndNonGenericInterfaceWithTheSameName.ts
TypeScript
// generic and non-generic interfaces with the same name do not merge interface A { foo: string; } interface A<T> { // error bar: T; } module M { interface A<T> { bar: T; } interface A { // error foo: string; } } module M2 { interface A { foo: string; } } m...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericAndNonGenericInterfaceWithTheSameName2.ts
TypeScript
// generic and non-generic interfaces with the same name do not merge module M { interface A<T> { bar: T; } } module M2 { interface A { // ok foo: string; } } module N { module M { interface A<T> { bar: T; } } module M2 { interface A { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallToOverloadedMethodWithOverloadedArguments.ts
TypeScript
module m1 { interface Promise<T> { then<U>(cb: (x: T) => Promise<U>): Promise<U>; } declare function testFunction(n: number): Promise<number>; var numPromise: Promise<number>; var newPromise = numPromise.then(testFunction); } ////////////////////////////////////// module m2 { interf...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallTypeArgumentInference.ts
TypeScript
// Basic type inference with generic calls, no errors expected function foo<T>(t: T) { return t; } var r = foo(''); // string function foo2<T, U>(t: T, u: U) { return u; } function foo2b<T, U>(u: U) { var x: T; return x; } var r2 = foo2('', 1); // number var r3 = foo2b(1); // {} class C<T, U> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithArrayLiteralArgs.ts
TypeScript
function foo<T>(t: T) { return t; } var r = foo([1, 2]); // number[] var r = foo<number[]>([1, 2]); // number[] var ra = foo<any[]>([1, 2]); // any[] var r2 = foo([]); // any[] var r3 = foo<number[]>([]); // number[] var r4 = foo([1, '']); // {}[] var r5 = foo<any[]>([1, '']); // any[] var r6 = foo<Object[]>([1, '...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithConstraintsTypeArgumentInference.ts
TypeScript
// Basic type inference with generic calls and constraints, no errors expected class Base { foo: string; } class Derived extends Base { bar: string; } class Derived2 extends Derived { baz: string; } var b: Base; var d1: Derived; var d2: Derived2; function foo<T extends Base>(t: T) { return t; } var r = foo(b); /...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithConstraintsTypeArgumentInference2.ts
TypeScript
// Generic call with parameters of T and U, U extends T, no parameter of type U function foo<T, U extends T>(t: T) { var u: U; return u; } var r = foo(1); // ok var r2 = foo(null); // {} var r3 = foo(new Object()); // {} var r4 = foo<Date, Date>(1); // error var r5 = foo<Date, Date>(new Date()); // no error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithConstructorTypedArguments5.ts
TypeScript
// Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args function foo<T, U>(arg: { cb: new(t: T) => U }) { return new arg.cb(null); } var arg: { cb: new<T>(x: T) => string }; var r = foo(arg); // {} // more args not ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithFunctionTypedArguments.ts
TypeScript
// Generic functions used as arguments for function typed parameters are not used to make inferences from // Using function arguments, no errors expected function foo<T>(x: (a: T) => T) { return x(null); } var r = foo(<U>(x: U) => ''); // {} var r2 = foo<string>(<U>(x: U) => ''); // string var r3 = foo(x => '');...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithFunctionTypedArguments2.ts
TypeScript
// Generic functions used as arguments for function typed parameters are not used to make inferences from // Using construct signature arguments, no errors expected function foo<T>(x: new(a: T) => T) { return new x(null); } interface I { new <T>(x: T): T; } interface I2<T> { new (x: T): T; } var i: I; var...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithFunctionTypedArguments3.ts
TypeScript
// No inference is made from function typed arguments which have multiple call signatures var a: { (x: boolean): boolean; (x: string): any; } function foo4<T, U>(cb: (x: T) => U) { var u: U; return u; } var r = foo4(a); // T is {} (candidates boolean and string), U is any (candidates any and boolean)...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithFunctionTypedArguments4.ts
TypeScript
// No inference is made from function typed arguments which have multiple call signatures class C { foo: string } class D { bar: string } var a: { new(x: boolean): C; new(x: string): D; } function foo4<T, U>(cb: new(x: T) => U) { var u: U; return u; } var r = foo4(a); // T is {} (candidates boolean a...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithFunctionTypedArguments5.ts
TypeScript
// Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args function foo<T, U>(arg: { cb: (t: T) => U }) { return arg.cb(null); } var arg = { cb: <T>(x: T) => '' }; var r = foo(arg); // {} // more args not allowed var r...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithGenericSignatureArguments.ts
TypeScript
// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. function foo<T>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithGenericSignatureArguments2.ts
TypeScript
// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. module onlyT { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithGenericSignatureArguments3.ts
TypeScript
// When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them. function foo<T>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithNonSymmetricSubtypes.ts
TypeScript
// generic type argument inference where inference leads to two candidates that are both supertypes of all candidates // we choose the first candidate so the result is dependent on the order of the arguments provided function foo<T>(x: T, y: T) { var r: T; return r; } var a: { x: number; y?: number; }; var b:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectLiteralArgs.ts
TypeScript
function foo<T>(x: { bar: T; baz: T }) { return x; } var r = foo({ bar: 1, baz: '' }); // error var r2 = foo({ bar: 1, baz: 1 }); // T = number var r3 = foo({ bar: foo, baz: foo }); // T = typeof foo var r4 = foo<Object>({ bar: 1, baz: '' }); // T = Object
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgs.ts
TypeScript
class C { private x: string; } class D { private x: string; } class X<T> { x: T; } function foo<T>(t: X<T>, t2: X<T>) { var x: T; return x; } var c1 = new X<C>(); var d1 = new X<D>(); var r = foo(c1, d1); // error var r2 = foo(c1, c1); // ok
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgs2.ts
TypeScript
class Base { x: string; } class Derived extends Base { y: string; } class Derived2 extends Base { z: string; } // returns {}[] function f<T extends Base, U extends Base>(a: { x: T; y: U }) { return [a.x, a.y]; } var r = f({ x: new Derived(), y: new Derived2() }); // {}[] var r2 = f({ x: new Base(), y:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndConstraints.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties // No errors expected class C { x: string; } class D { x: string; y: string; } class X<T> { x: T; } function foo<T extends { x: string }>(t: X<T>, t2: X<T>) { var x: T; return x; } var c1 = new X<C>(); va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndConstraints2.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties // No errors expected class Base { x: string; } class Derived extends Base { y: string; } function f<T extends Base>(x: { foo: T; bar: T }) { var r: T; return r; } var r = f({ foo: new Base(), bar: new Derived() });...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndConstraints3.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties class Base { x: string; } class Derived extends Base { y: string; } class Derived2 extends Base { z: string; } function f<T extends Base>(a: { x: T; y: T }) { var r: T; return r; } var r1 = f({ x: new Derived()...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndConstraints4.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties class C { x: string; } class D { x: string; y: string; } function foo<T, U extends T>(t: T, t2: U) { return (x: T) => t2; } var c: C; var d: D; var r = foo(c, d); var r2 = foo(d, c); // error because C does not ex...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndConstraints5.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties class C { x: string; } class D { x: string; y: string; } function foo<T, U extends T>(t: T, t2: U) { return (x: T) => t2; } var c: C; var d: D; var r2 = foo(d, c); // the constraints are self-referencing, no downs...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndIndexers.ts
TypeScript
// Type inference infers from indexers in target type, no errors expected function foo<T>(x: T) { return x; } var a: { [x: string]: Object; [x: number]: Date; }; var r = foo(a); function other<T extends Date>(arg: T) { var b: { [x: string]: Object; [x: number]: T }; var r2 = f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndIndexersErrors.ts
TypeScript
// Type inference infers from indexers in target type, error cases function foo<T>(x: T) { return x; } function other<T>(arg: T) { var b: { [x: string]: Object; [x: number]: T; // ok, T is a subtype of Object because its apparent type is {} }; var r2 = foo(b); // T } function other3<T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndInitializers.ts
TypeScript
// Generic typed parameters with initializers function foo<T>(x: T = null) { return x; } // ok function foo2<T>(x: T = undefined) { return x; } // ok function foo3<T extends Number>(x: T = 1) { } // error function foo4<T, U extends T>(x: T, y: U = x) { } // error function foo5<T, U extends T>(x: U, y: T = x) { } // ok...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndNumericIndexer.ts
TypeScript
// Type inference infers from indexers in target type, no errors expected function foo<T>(x: T) { return x; } var a: { [x: number]: Date }; var r = foo(a); function other<T>(arg: T) { var b: { [x: number]: T }; var r2 = foo(b); // T } function other2<T extends Date>(arg: T) { var b: { [x: number]: T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithObjectTypeArgsAndStringIndexer.ts
TypeScript
// Type inference infers from indexers in target type, no errors expected function foo<T>(x: T) { return x; } var a: { [x: string]: Date }; var r = foo(a); function other<T>(arg: T) { var b: { [x: string]: T }; var r2 = foo(b); // T } function other2<T extends Date>(arg: T) { var b: { [x: string]: T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithOverloadedConstructorTypedArguments.ts
TypeScript
// Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { var a: { new(x: boolean): boolean; new(x: string): string; } function foo4(c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithOverloadedConstructorTypedArguments2.ts
TypeScript
// Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { var a: { new(x: boolean): boolean; new(x: string): string; } function foo4(c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithOverloadedFunctionTypedArguments.ts
TypeScript
// Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { var a: { (x: boolean): boolean; (x: string): string; } function foo4(cb: typ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithOverloadedFunctionTypedArguments2.ts
TypeScript
// Function typed arguments with multiple signatures must be passed an implementation that matches all of them // Inferences are made quadratic-pairwise to and from these overload sets module NonGenericParameter { var a: { (x: boolean): boolean; (x: string): string; } function foo4(cb: typ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericCallWithTupleType.ts
TypeScript
interface I<T, U> { tuple1: [T, U]; } var i1: I<string, number>; var i2: I<{}, {}>; // no error i1.tuple1 = ["foo", 5]; var e1 = i1.tuple1[0]; // string var e2 = i1.tuple1[1]; // number i1.tuple1 = ["foo", 5, false, true]; var e3 = i1.tuple1[2]; // {} i1.tuple1[3] = { a: "string" }; var e4 = i1.tuple1[3]; /...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericClassExpressionInFunction.ts
TypeScript
class A<T> { genericVar: T } function B1<U>() { // class expression can use T return class extends A<U> { } } class B2<V> { anon = class extends A<V> { } } function B3<W>() { return class Inner<TInner> extends A<W> { } } // extends can call B class K extends B1<number>() { namae: string; } clas...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericClassWithFunctionTypedMemberArguments.ts
TypeScript
// Generic functions used as arguments for function typed parameters are not used to make inferences from // Using function arguments, no errors expected module ImmediatelyFix { class C<T> { foo<T>(x: (a: T) => T) { return x(null); } } var c = new C<number>(); var r = c.foo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericClassWithObjectTypeArgsAndConstraints.ts
TypeScript
// Generic call with constraints infering type parameter from object member properties // No errors expected class C { x: string; } class D { x: string; y: string; } class X<T> { x: T; } module Class { class G<T extends { x: string }> { foo<T extends { x: string }>(t: X<T>, t2: X<T>) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericContextualTypes1.ts
TypeScript
// @strict: true // @declaration: true type Box<T> = { value: T }; declare function wrap<A, B>(f: (a: A) => B): (a: A) => B; declare function compose<A, B, C>(f: (a: A) => B, g: (b: B) => C): (a: A) => C; declare function list<T>(a: T): T[]; declare function unlist<T>(a: T[]): T; declare function box<V>(x: V): Bo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericContextualTypes2.ts
TypeScript
// @strict: true // @noEmit: true type LowInfer<T> = T & {}; type PartialAssigner<TContext, TKey extends keyof TContext> = ( context: TContext ) => TContext[TKey]; type PropertyAssigner<TContext> = { [K in keyof TContext]?: PartialAssigner<TContext, K> | TContext[K]; }; type Meta<TContext> = { action: (ctx: T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericContextualTypes3.ts
TypeScript
// @strict: true // @noEmit: true type LowInfer<T> = T & {}; type PartialAssigner<TContext, TKey extends keyof TContext> = ( context: TContext ) => TContext[TKey]; type PropertyAssigner<TContext> = { [K in keyof TContext]?: PartialAssigner<TContext, K> | TContext[K]; }; type Meta<TContext> = { action: (ctx: T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericFunctionParameters.ts
TypeScript
// @strict: true // @declaration: true declare function f1<T>(cb: <S>(x: S) => T): T; declare function f2<T>(cb: <S extends number>(x: S) => T): T; declare function f3<T>(cb: <S extends Array<S>>(x: S) => T): T; let x1 = f1(x => x); // {} let x2 = f2(x => x); // number let x3 = f3(x => x); // Array<any> // Repro ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericInstantiationEquivalentToObjectLiteral.ts
TypeScript
interface Pair<T1, T2> { first: T1; second: T2; } var x: Pair<string, number> var y: { first: string; second: number; } x = y; y = x; declare function f<T, U>(x: Pair<T, U>); declare function f2<T, U>(x: { first: T; second: U; }); f(x); f(y); f2(x); f2(y);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericObjectRest.ts
TypeScript
// @strict: true // @target: es2015 const a = 'a'; function f1<T extends { a: string, b: number }>(obj: T) { let { ...r0 } = obj; let { a: a1, ...r1 } = obj; let { a: a2, b: b2, ...r2 } = obj; let { 'a': a3, ...r3 } = obj; let { ['a']: a4, ...r4 } = obj; let { [a]: a5, ...r5 } = obj; } const ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericRestArity.ts
TypeScript
// Repro from #25559 declare function call<TS extends unknown[]>( handler: (...args: TS) => void, ...args: TS): void; call((x: number, y: number) => x + y); call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericRestArityStrict.ts
TypeScript
// @strict: true // Repro from #25559 declare function call<TS extends unknown[]>( handler: (...args: TS) => void, ...args: TS): void; call((x: number, y: number) => x + y); call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericRestParameters1.ts
TypeScript
// @strict: true // @declaration: true declare let f1: (...x: [number, string, boolean]) => void; declare let f2: (x0: number, x1: string, x2: boolean) => void; f1 = f2; f2 = f1; declare const t3: [number, string, boolean]; declare const t2: [string, boolean]; declare const t1: [boolean]; declare const t0: []; decl...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericRestParameters2.ts
TypeScript
// @strict: true // @declaration: true declare const t1: [number, string, ...boolean[]]; declare const t2: [string, ...boolean[]]; declare const t3: [...boolean[]]; declare const t4: []; declare let f00: (...x: [number, string, boolean]) => void; declare let f01: (a: number, ...x: [string, boolean]) => void; declare ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericRestParameters3.ts
TypeScript
// @strict: true // @declaration: true declare let f1: (x: string, ...args: [string] | [number, boolean]) => void; declare let f2: (x: string, y: string) => void; declare let f3: (x: string, y: number, z: boolean) => void; declare let f4: (...args: [string, string] | [string, number, boolean]) => void; declare const ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericSetterInClassType.ts
TypeScript
// @target: esnext module Generic { class C<T> { get y(): T { return 1 as never; } set y(v) { } } var c = new C<number>(); c.y = c.y; class Box<T> { #value!: T; get value() { return this.#value; } set va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericSetterInClassTypeJsDoc.ts
TypeScript
// @target: esnext // @lib: esnext // @declaration: true // @allowJs: true // @checkJs: true // @filename: genericSetterInClassTypeJsDoc.js // @outFile: genericSetterInClassTypeJsDoc-out.js /** * @template T */ class Box { #value; /** @param {T} initialValue */ constructor(initialValue) { this....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/genericTypeAliases.ts
TypeScript
type Tree<T> = T | { left: Tree<T>, right: Tree<T> }; var tree: Tree<number> = { left: { left: 0, right: { left: 1, right: 2 }, }, right: 3 }; type Lazy<T> = T | (() => T); var ls: Lazy<string>; ls = "eager"; ls = () => "lazy"; type Foo<T> = T | { x: Foo<T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/getSetAccessorContextualTyping.ts
TypeScript
// @target: es5 // In the body of a get accessor with no return type annotation, // if a matching set accessor exists and that set accessor has a parameter type annotation, // return expressions are contextually typed by the type given in the set accessor's parameter type annotation. class C { set X(x: number) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalAugmentationModuleResolution.ts
TypeScript
// @traceResolution: true // @fileName: a.ts export { }; declare global { var x: number; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalMergeWithCommonJSAssignmentDeclaration.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: bug27099.js window.name = 1; window.console; // should not have error: Property 'console' does not exist on type 'typeof window'. module.exports = 'anything';
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisAmbientModules.ts
TypeScript
declare module "ambientModule" { export type typ = 1 export var val: typ } namespace valueModule { export var val = 1 } namespace namespaceModule { export type typ = 1 } // should error type GlobalBad1 = (typeof globalThis)["\"ambientModule\""] type GlobalOk1 = (typeof globalThis)["valueModule"] type GlobalOk2 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisBlockscopedProperties.ts
TypeScript
// @noImplicitAny: true var x = 1 const y = 2 let z = 3 globalThis.x // ok globalThis.y // should error, no property 'y' globalThis.z // should error, no property 'z' globalThis['x'] // ok globalThis['y'] // should error, no property 'y' globalThis['z'] // should error, no property 'z' globalThis.Float64Array // ok glo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisCollision.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @filename: globalThisCollision.js var globalThis;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisGlobalExportAsGlobal.ts
TypeScript
// https://github.com/microsoft/TypeScript/issues/33754 declare global { export { globalThis as global } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisPropertyAssignment.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: globalThisPropertyAssignment.js this.x = 1 var y = 2 // should work in JS window.z = 3 // should work in JS (even though it's a secondary declaration) globalThis.alpha = 4
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisReadonlyProperties.ts
TypeScript
globalThis.globalThis = 1 as any // should error var x = 1 const y = 2 globalThis.x = 3 globalThis.y = 4 // should error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisTypeIndexAccess.ts
TypeScript
declare const w_e: (typeof globalThis)["globalThis"]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisUnknown.ts
TypeScript
declare let win: Window & typeof globalThis; // this access should be an error win.hi // these two should be fine, with type any this.hi globalThis.hi // element access is always ok without noImplicitAny win['hi'] this['hi'] globalThis['hi']
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisUnknownNoImplicitAny.ts
TypeScript
// @noImplicitAny: true declare let win: Window & typeof globalThis; // all accesses should be errors win.hi this.hi globalThis.hi win['hi'] this['hi'] globalThis['hi']
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/globalThisVarDeclaration.ts
TypeScript
// @outFile: output.js // @target: esnext // @lib: esnext, dom // @Filename: b.js // @allowJs: true // @checkJs: true var a = 10; this.a; this.b; globalThis.a; globalThis.b; // DOM access is not supported until the index signature is handled more strictly self.a; self.b; window.a; window.b; top.a; top.b; // @Filename...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/grammarAmbiguities.ts
TypeScript
function f(n: any) { return null; } function g<A, B>(x: any) { return null; } interface A { } interface B { } var A, B; f(g<A, B>(7)); f(g < A, B > 7); // Should error f(g < A, B > +(7)); // Should error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/heterogeneousArrayLiterals.ts
TypeScript
// type of an array is the best common type of its elements (plus its contextual type if it exists) var a = [1, '']; // {}[] var b = [1, null]; // number[] var c = [1, '', null]; // {}[] var d = [{}, 1]; // {}[] var e = [{}, Object]; // {}[] var f = [[], [1]]; // number[][] var g = [[1], ['']]; // {}[] var h = [{ fo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/identicalCallSignatures.ts
TypeScript
// Each pair of call signatures in these types have a duplicate signature error. // Identical call signatures should generate an error. interface I { (x): number; (x: any): number; <T>(x: T): T; <U>(x: U): U; // error } interface I2<T> { (x: T): T; (x: T): T; // error } var a: { (x): numbe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/identicalCallSignatures2.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 bases. interface Base<T> { (x: number): string; } interface I extends Base<string>, Base<number> { } interface I2<T> extends Base<string>, Base<number> {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/identicalCallSignatures3.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, so we do not report errors. interface I { (x: number): string; } interface I { (x: number): string; } interface I2<T> { (x: ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ifDoWhileStatements.ts
TypeScript
// @allowUnreachableCode: true interface I { id: number; } class C implements I { id: number; name: string; } class C2 extends C { valid: boolean; } class D<T>{ source: T; recurse: D<T>; wrapped: D<D<T>> } function F(x: string): number { return 42; } function F2(x: number): boolean { re...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/implementingAnInterfaceExtendingClassWithPrivates.ts
TypeScript
class Foo { private x: string; } interface I extends Foo { y: number; } class Bar implements I { // error } class Bar2 implements I { // error y: number; } class Bar3 implements I { // error x: string; y: number; } class Bar4 implements I { // error private x: string; y: number; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/implementingAnInterfaceExtendingClassWithPrivates2.ts
TypeScript
class Foo { private x: string; } interface I extends Foo { y: number; } class Bar extends Foo implements I { // ok y: number; } class Bar2 extends Foo implements I { // error x: string; y: number; } class Bar3 extends Foo implements I { // error private x: string; y: number; } // anothe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/implementingAnInterfaceExtendingClassWithProtecteds.ts
TypeScript
class Foo { protected x: string; } interface I extends Foo { y: number; } class Bar implements I { // error } class Bar2 implements I { // error y: number; } class Bar3 implements I { // error x: string; y: number; } class Bar4 implements I { // error protected x: string; y: number; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/implementsClause.ts
TypeScript
// @Filename: types.ts export interface Component {} // @Filename: ns.ts import type * as types from './types'; export { types }; // @Filename: index.ts import type * as types from './types'; import * as nestedNamespace from './ns'; class C implements types.Component {} class D implements nestedNamespace.types.Compo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAliasIdentifiers.ts
TypeScript
module moduleA { export class Point { constructor(public x: number, public y: number) { } } } import alias = moduleA; var p: alias.Point; var p: moduleA.Point; var p: { x: number; y: number; }; class clodule { name: string; } module clodule { export interface Point { x: number; y: nu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAliasModuleExports.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @esModuleInterop: true // @filename: mod1.js class Alias { bar() { return 1 } } module.exports = Alias; // @filename: main.js import A from './mod1' A.prototype.foo = 0 A.prototype.func = function() { this._func = 0; } Object.defineProperty(A.prototype, "def"...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAssertion2.ts
TypeScript
// @declaration: true // @target: es2015 // @module: es2015, commonjs, esnext // @filename: 0.ts export const a = 1; export const b = 2; // @filename: 1.ts export {} from './0' assert { type: "json" } export { a, b } from './0' assert { type: "json" } export * from './0' assert { type: "json" } export * as ns from '....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAssertion3.ts
TypeScript
// @declaration: true // @target: es2015 // @module: es2015, esnext // @filename: 0.ts export interface I { } // @filename: 1.ts export type {} from './0' assert { type: "json" } export type { I } from './0' assert { type: "json" } // @filename: 2.ts import type { I } from './0' assert { type: "json" } import type ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAttributes2.ts
TypeScript
// @declaration: true // @target: es2015 // @module: es2015, commonjs, esnext // @filename: 0.ts export const a = 1; export const b = 2; // @filename: 1.ts export {} from './0' with { type: "json" } export { a, b } from './0' with { type: "json" } export * from './0' with { type: "json" } export * as ns from './0' wi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAttributes3.ts
TypeScript
// @declaration: true // @target: es2015 // @module: es2015, esnext // @filename: 0.ts export interface I { } // @filename: 1.ts export type {} from './0' with { type: "json" } export type { I } from './0' with { type: "json" } // @filename: 2.ts import type { I } from './0' with { type: "json" } import type * as f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAttributes6.ts
TypeScript
// @module: nodenext // @filename: mod.mts import * as thing1 from "./mod.mjs" with { field: 0 }; import * as thing2 from "./mod.mjs" with { field: `a` }; import * as thing3 from "./mod.mjs" with { field: /a/g }; import * as thing4 from "./mod.mjs" with { field: ["a"] }; import * as thing5 from "./mod.mjs" with { field...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importAttributes8.ts
TypeScript
// @module: esnext // @lib: es2015 // @filename: /a.ts export default { a: "a", b: "b", } // @filename: /b.ts import a from "./a" with { a: "a", "b": "b" }; // ok
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression1ES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @filename: 0.ts export function foo() { return "foo"; } // @filename: 1.ts import("./0"); var p1 = import("./0"); p1.then(zero => { return zero.foo(); }) export var p2 = import("./0"); function foo() { const p2 = import("./0"); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression2ES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @filename: 0.ts export class B { print() { return "I am B"} } // @filename: 2.ts function foo(x: Promise<any>) { x.then(value => { let b = new value.B(); b.print(); }) } foo(import("./0"));
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression3ES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @filename: 0.ts export class B { print() { return "I am B"} } // @filename: 2.ts async function foo() { class C extends (await import("./0")).B {} var c = new C(); c.print(); } foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression4ES2020.ts
TypeScript
// @lib: es2020 // @module: es2020 // @target: es2020 // @filename: 0.ts export class B { print() { return "I am B"} } export function foo() { return "foo" } // @filename: 1.ts export function backup() { return "backup"; } // @filename: 2.ts declare var console: any; class C { private myModule = import("./0...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression5ES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @strictNullChecks: true // @filename: 0.ts export class B { print() { return "I am B"} } export function foo() { return "foo" } // @filename: 1.ts export function backup() { return "backup"; } // @filename: 2.ts declare function bar(): boolean; const specify = bar() ? "....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpression6ES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @filename: 0.ts export class B { print() { return "I am B"} } export function foo() { return "foo" } // @filename: 1.ts export function backup() { return "backup"; } // @filename: 2.ts declare function bar(): boolean; const specify = bar() ? "./0" : undefined; let myModu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES2020.ts
TypeScript
// @module: es2020 // @target: es2020 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await import('./tes...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES5AMD.ts
TypeScript
// @module: amd // @target: es5 // @lib: es6 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await import...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES5CJS.ts
TypeScript
// @module: commonjs // @target: es5 // @lib: es6 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await i...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES5System.ts
TypeScript
// @module: system // @target: es5 // @lib: es6 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await imp...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES5UMD.ts
TypeScript
// @module: umd // @target: es5 // @lib: es6 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await import...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES6AMD.ts
TypeScript
// @module: amd // @target: es6 // @filename: test.ts export async function fn() { const req = await import('./test') // ONE } export class cl1 { public async m() { const req = await import('./test') // TWO } } export const obj = { m: async () => { const req = await import('./test') //...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University