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/typeParameterUsedAsConstraint.ts | TypeScript | class C<T, U extends T> { }
class C2<T extends U, U> { }
class C3<T extends Date, U extends T> { }
class C4<T extends U, U extends Date> { }
class C5<T extends U, U extends V, V> { }
class C6<T, U extends T, V extends U> { }
interface I<T, U extends T> { }
interface I2<T extends U, U> { }
interface I3<T extends Date, ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParameterUsedAsTypeParameterConstraint.ts | TypeScript | // Type parameters are in scope in their own and other type parameter lists
function foo<T, U extends T>(x: T, y: U): T {
x = y;
return y;
}
function foo2<U extends T, T>(x: T, y: U): T {
x = y;
return y;
}
var f = function <T, U extends T>(x: T, y: U): T {
x = y;
return y;
}
var f2 = functi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParameterUsedAsTypeParameterConstraint2.ts | TypeScript | // Type parameters are in scope in their own and other type parameter lists
// Nested local functions
function foo<T, U extends T>(x: T, y: U) {
function bar<V extends T, W extends U>() {
function baz<X extends W, Y extends V>(a: X, b: Y): T {
x = y;
return y;
}
}
}
fun... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParameterUsedAsTypeParameterConstraint3.ts | TypeScript | // Type parameters are in scope in their own and other type parameter lists
// Object types
//class C<T, U extends T, V extends U> {
// x: T;
// y: U;
// z: V;
// foo<W extends V>(x: W): T {
// var r: T;
// return x;
// }
//}
//class C2<V extends U, T, U extends T> {
// x: T;
// y: ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParameterUsedAsTypeParameterConstraint4.ts | TypeScript | // Type parameters are in scope in their own and other type parameter lists
// Some negative cases
class C<T, U extends T, V extends U> {
z: W; // error
foo<W extends V>(x: W): T {
var r: T;
return x;
}
}
interface I<T, U extends T, V extends U> {
x: T;
y: U;
z: W; // error
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParametersAreIdenticalToThemselves.ts | TypeScript | // type parameters from the same declaration are identical to themself
function foo1<T>(x: T);
function foo1<T>(x: T); // no error, different declaration for each T
function foo1<T>(x: T) { }
function foo2<T, U>(x: T);
function foo2<T, U>(x: T); // no error, different declaration for each T
function foo2<T, U>(x: T) ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParametersAvailableInNestedScope.ts | TypeScript | class C<T> {
data: T;
x = <U>(a: U) => {
var y: T;
return y;
}
foo() {
function temp<U>(a: U) {
var y: T;
return y;
}
return temp(<T>null);
}
}
var c = new C<number>();
c.data = c.x(null);
c.data = c.foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParametersAvailableInNestedScope2.ts | TypeScript | function foo<T, U>(x: T, y: U) {
function bar<V>(z: V) {
function baz<W>(a: W) {
var c: T;
var d: U;
var e: V;
}
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeParametersAvailableInNestedScope3.ts | TypeScript | // @declaration: true
function foo<T>(v: T) {
function a<T>(a: T) { return a; }
function b(): T { return v; }
function c<T>(v: T) {
function a<T>(a: T) { return a; }
function b(): T { return v; }
return { a, b };
}
return { a, b, c };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typePredicateASI.ts | TypeScript | interface I {
foo(callback: (a: any, b: any) => void): I
is(): boolean;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeQuery.ts | TypeScript | // @Filename: /a.ts
export class A { }
// @Filename: /b.ts
import type { A } from './a';
let AConstructor: typeof A;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeQueryOnClass.ts | TypeScript | class C<T> {
constructor(x: number);
constructor(x: string);
constructor(public x) { }
static foo(x: number);
static foo(x: {});
static foo(x) { }
static bar(x) { }
static sa = 1;
static sb = () => 1;
static get sc() {
return 1;
}
static set sc(x) {
}
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeQueryWithReservedWords.ts | TypeScript | class Controller {
create() {
}
delete() {
}
var() {
}
}
interface IScope {
create: typeof Controller.prototype.create;
delete: typeof Controller.prototype.delete; // Should not error
var: typeof Controller.prototype.var; // Should not error
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeRelationships.ts | TypeScript | class C {
self = this;
c = new C();
foo() {
return this;
}
f1() {
this.c = this.self;
this.self = this.c; // Error
}
f2() {
var a: C[];
var a = [this, this.c]; // C[] since this is subtype of C
var b: this[];
var b = [this, this.self,... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_asConstArrays.ts | TypeScript | // @strict: true
// @noEmit: true
// with readonly array
const arr1 = [1, 2, 3] as const satisfies readonly unknown[]
// with mutable array
const arr2 = [1, 2, 3] as const satisfies unknown[]
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_contextualTyping1.ts | TypeScript | type Predicates = { [s: string]: (n: number) => boolean };
const p = {
isEven: n => n % 2 === 0,
isOdd: n => n % 2 === 1
} satisfies Predicates;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_contextualTyping2.ts | TypeScript | // @strict: true
let obj: { f(s: string): void } & Record<string, unknown> = {
f(s) { }, // "incorrect" implicit any on 's'
g(s) { }
} satisfies { g(s: string): void } & Record<string, unknown>;
// This needs to not crash (outer node is not expression)
({ f(x) { } }) satisfies { f(s: string): void };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_contextualTyping3.ts | TypeScript | // @strict: true
// @noEmit: true
// see https://github.com/microsoft/TypeScript/issues/53920#issuecomment-1516616255
const obj = {
foo: (param = "default") => param,
} satisfies {
[key: string]: (...params: any) => any;
};
const obj2 = {
foo: (param = "default") => param,
} satisfies {
[key: string]: Fu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_ensureInterfaceImpl.ts | TypeScript | type Movable = {
move(distance: number): void;
};
const car = {
start() { },
move(d) {
// d should be number
},
stop() { }
} satisfies Movable & Record<string, unknown>;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_js.ts | TypeScript | // @allowJs: true
// @filename: /src/a.js
// @outFile: /lib/a.js
var v = undefined satisfies 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_optionalMemberConformance.ts | TypeScript | type Point2d = { x: number, y: number };
// Undesirable behavior today with type annotation
const a = { x: 10 } satisfies Partial<Point2d>;
// Should OK
console.log(a.x.toFixed());
// Should error
let p = a.y;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_propNameConstraining.ts | TypeScript | type Keys = 'a' | 'b' | 'c' | 'd';
const p = {
a: 0,
b: "hello",
x: 8 // Should error, 'x' isn't in 'Keys'
} satisfies Partial<Record<Keys, unknown>>;
// Should be OK -- retain info that a is number and b is string
let a = p.a.toFixed();
let b = p.b.substring(1);
// Should error even though 'd' is in 'Key... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_propertyNameFulfillment.ts | TypeScript | type Keys = 'a' | 'b' | 'c' | 'd';
const p = {
a: 0,
b: "hello",
x: 8 // Should error, 'x' isn't in 'Keys'
} satisfies Record<Keys, unknown>;
// Should be OK -- retain info that a is number and b is string
let a = p.a.toFixed();
let b = p.b.substring(1);
// Should error even though 'd' is in 'Keys'
let d ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_propertyValueConformance1.ts | TypeScript | // @noPropertyAccessFromIndexSignature: true, false
type Facts = { [key: string]: boolean };
declare function checkTruths(x: Facts): void;
declare function checkM(x: { m: boolean }): void;
const x = {
m: true
};
// Should be OK
checkTruths(x);
// Should be OK
checkM(x);
// Should fail under --noPropertyAccessFrom... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_propertyValueConformance2.ts | TypeScript | // @noUncheckedIndexedAccess: true, false
type Facts = { [key: string]: boolean };
declare function checkTruths(x: Facts): void;
declare function checkM(x: { m: boolean }): void;
const x = {
m: true
};
// Should be OK
checkTruths(x);
// Should be OK
checkM(x);
console.log(x.z);
// Should be OK under --noUnchecked... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_propertyValueConformance3.ts | TypeScript | export type Color = { r: number, g: number, b: number };
// All of these should be Colors, but I only use some of them here.
export const Palette = {
white: { r: 255, g: 255, b: 255 },
black: { r: 0, g: 0, d: 0 }, // <- oops! 'd' in place of 'b'
blue: { r: 0, g: 0, b: 255 },
} satisfies Record<string, Colo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeSatisfaction_vacuousIntersectionOfContextualTypes.ts | TypeScript | const a: "baz" = "foo" satisfies "foo" | "bar";
const b: { xyz: "baz" } = { xyz: "foo" } satisfies { xyz: "foo" | "bar" };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagCircularReferenceOnConstructorFunction.ts | TypeScript | // @allowJs: true
// @noEmit: true
// @checkJs: true
// @Filename: bug27346.js
/**
* @type {MyClass}
*/
function MyClass() { }
MyClass.prototype = {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagModuleExports.ts | TypeScript | // @Filename: bug27327.js
// @noEmit: true
// @allowJs: true
// @checkJs: true
/** @type {string} */
module.exports = 0;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagNoErasure.ts | TypeScript | // @checkJs:true
// @declaration: true
// @outdir: out/
// @filename: typeTagNoErasure.js
/** @template T @typedef {<T1 extends T>(data: T1) => T1} Test */
/** @type {Test<number>} */
const test = dibbity => dibbity
test(1) // ok, T=1
test('hi') // error, T=number
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagOnFunctionReferencesGeneric.ts | TypeScript | // @checkJs: true
// @declaration: true
// @outDir: out/
// @filename: typeTagOnFunctionReferencesGeneric.js
/**
* @typedef {<T>(m : T) => T} IFn
*/
/**@type {IFn}*/
export function inJs(l) {
return l;
}
inJs(1); // lints error. Why?
/**@type {IFn}*/
const inJsArrow = (j) => {
return j;
}
inJsArrow(2); // n... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagOnPropertyAssignment.ts | TypeScript | // @noEmit: true
// @checkJs: true
// @filename: typeTagOnPropertyAssignment.js
const o = {
/**
* @type {"a"}
*/
a: "a",
/** @type {() => 'b'} */
n: () => 'b'
};
o.a
o.n
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagPrototypeAssignment.ts | TypeScript | // @Filename: bug27327.js
// @noEmit: true
// @allowJs: true
// @checkJs: true
function C() {
}
/** @type {string} */
C.prototype = 12
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeTagWithGenericSignature.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @strict: true
// @Filename: bug25618.js
/** @type {<T>(param?: T) => T | undefined} */
function typed(param) {
return param;
}
var n = typed(1);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeValueMerge1.ts | TypeScript | // @noEmit: true
// @Filename: other.ts
export type A = string;
function A() {}
export { A };
export type B = string;
var B = 10;
export { B };
// @Filename: main.ts
import { A, B } from "./other";
A();
export const C = B;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefCrossModule.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: commonjs.d.ts
declare var module: { exports: any};
// @Filename: mod1.js
/// <reference path="./commonjs.d.ts"/>
/** @typedef {{ type: "a", x: 1 }} A */
/** @typedef {{ type: "b", y: 1 }} B */
/** @typedef {A | B} Both */
module.exports = C
function C()... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefCrossModule2.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod1.js
// error
/** @typedef {number} Foo */
class Foo { } // should error
/** @typedef {number} Bar */
exports.Bar = class { }
/** @typedef {number} Baz */
module.exports = {
Baz: class { }
}
// ok
/** @typedef {number} Qux */
var Qux = 2;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefCrossModule3.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod2.js
/** @typedef {number} Foo */
const ns = {};
ns.Foo = class {}
module.exports = ns;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefCrossModule4.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod3.js
/** @typedef {number} Foo */
class Bar { }
module.exports = { Foo: Bar };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefCrossModule5.ts | TypeScript | // @pretty: true
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod1.js
/** @typedef {number} Foo */
class Bar {}
// @Filename: mod2.js
class Foo { } // should error
const Bar = 3;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefDuplicateTypeDeclaration.ts | TypeScript | // @allowJS: true
// @checkJS: true
// @noEmit: true
// @Filename: typedefDuplicateTypeDeclaration.js
/**
* @typedef Name
* @type {string}
* @type {Oops}
*/ | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefInnerNamepaths.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: bug25104.js
class C {
/**
* @typedef {C~A} C~B
* @typedef {object} C~A
*/
/** @param {C~A} o */
constructor(o) {
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefMultipleTypeParameters.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
/**
* @template {{ a: number, b: string }} T,U A Comment
* @template {{ c: boolean }} V uh ... are comments even supported??
* @template W
* @template X That last one had no comment
* @typedef {{ t: T, u: U, v: V, w: W, x: X }} Everything
*/
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefOnSemicolonClassElement.ts | TypeScript | // @filename: typedefOnSemicolonClassElement.js
// @checkJs: true
// @outdir: dist
// @declaration: true
export class Preferences {
/** @typedef {string} A */
;
/** @type {A} */
a = 'ok'
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefScope1.ts | TypeScript | // @strict: true
// @declaration: true
// @outdir: out/
// @checkJs: true
// @filename: typedefScope1.js
function B1() {
/** @typedef {number} B */
/** @type {B} */
var ok1 = 0;
}
function B2() {
/** @typedef {string} B */
/** @type {B} */
var ok2 = 'hi';
}
/** @type {B} */
var notOK = 0;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefTagExtraneousProperty.ts | TypeScript | // @lib: es5
// @allowjs: true
// @checkjs: true
// @noemit: true
// @Filename: typedefTagExtraneousProperty.js
/** @typedef {Object.<string,string>} Mmap
* @property {string} ignoreMe - should be ignored
*/
/** @type {Mmap} */
var y = { bye: "no" };
y
y.ignoreMe = "ok but just because of the index signature"
y['hi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefTagNested.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js
/** @typedef {Object} App
* @property {string} name
* @property {Object} icons
* @property {string} icons.image32
* @property {string} icons.image64
*/
var ex;
/** @type {App} */
const app = {
name: 'name',
icons: {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefTagTypeResolution.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: github20832.js
// #20832
/** @typedef {U} T - should be "error, can't find type named 'U' */
/**
* @template U
* @param {U} x
* @return {T}
*/
function f(x) {
return x;
}
/** @type T - should be fine, since T will be any */
const x = 3;
/**
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typedefTagWrapping.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod1.js
/**
* @typedef {function(string): boolean}
* Type1
*/
/**
* Tries to use a type whose name is on a different
* line than the typedef tag.
* @param {Type1} func The function to call.
* @param {string} arg The argument to call it with.
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofANonExportedType.ts | TypeScript | var x = 1;
export var r1: typeof x;
var y = { foo: '' };
export var r2: typeof y;
class C {
foo: string;
}
export var c: C;
var c2: C;
export var r3: typeof C;
export var r4: typeof c;
export var r4b: typeof c2;
interface I {
foo: string;
}
export var i: I;
var i2: I;
export var r5: typeof i;
export var r5: t... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofAnExportedType.ts | TypeScript | export var x = 1;
export var r1: typeof x;
export var y = { foo: '' };
export var r2: typeof y;
export class C {
foo: string;
}
export var c: C;
var c2: C;
export var r3: typeof C;
export var r4: typeof c;
export var r4b: typeof c2;
export interface I {
foo: string;
}
export var i: I;
var i2: I;
export var r5... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofClass2.ts | TypeScript | class C {
constructor(x: number);
constructor(x: string);
constructor(x) { }
static foo(x: number);
static foo(x: C);
static foo(x) { }
static bar(x) { }
}
class D extends C {
static baz(x: number) { }
foo() { }
}
var d: D;
var r1: typeof D;
var r2: typeof d; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofClassWithPrivates.ts | TypeScript | class C<T> {
private a: number;
private static b: number;
x: T;
static y: T;
}
var c: C<string>;
var r: typeof C;
var r2: typeof c; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofImportTypeOnlyExport.ts | TypeScript | // @declaration: true
// @Filename: button.ts
import {classMap} from './lit.js';
export const c = classMap();
// @Filename: lit.ts
class ClassMapDirective {}
export type {ClassMapDirective};
export const directive =
<C>(class_: C) =>
() => ({
directive: class_,
});
export const classMap = directive(Class... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofModuleWithoutExports.ts | TypeScript | module M {
var x = 1;
class C {
foo: number;
}
}
var r: typeof M; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofOperatorWithAnyOtherType.ts | TypeScript | // typeof operator on any type
var ANY: any;
var ANY1;
var ANY2: any[] = ["", ""];
var obj: () => {}
var obj1 = { x: "a", 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 ob... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofOperatorWithBooleanType.ts | TypeScript | // @allowUnusedLabels: true
// typeof 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 ResultIsString1 = typeof BOOLEAN;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofOperatorWithEnumType.ts | TypeScript | // @allowUnusedLabels: true
// typeof operator on enum type
enum ENUM { };
enum ENUM1 { A, B, "" };
// enum type var
var ResultIsString1 = typeof ENUM;
var ResultIsString2 = typeof ENUM1;
// enum type expressions
var ResultIsString3 = typeof ENUM1["A"];
var ResultIsString4 = typeof (ENUM[0] + ENUM1["B"]);
// mult... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofOperatorWithNumberType.ts | TypeScript | // @allowUnusedLabels: true
// typeof 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 ResultIsString1 =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofOperatorWithStringType.ts | TypeScript | // typeof 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 ResultIsString1 = typeof STRING;
va... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofThis.ts | TypeScript | // @noImplicitThis: true
// @strict: true
class Test {
data = {};
constructor() {
var copy: typeof this.data = {};
}
}
class Test1 {
data = { foo: '' };
['this'] = '';
constructor() {
var copy: typeof this.data = { foo: '' };
var foo: typeof this.data.foo = '';
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofThisWithImplicitThis.ts | TypeScript | // @noImplicitThis: false
function Test1() {
let x: typeof this.no = 1
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typeofTypeParameter.ts | TypeScript | function f<T>(x: T): T {
var a: typeof x;
var y: typeof T;
return a;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/types.asyncGenerators.es2018.1.ts | TypeScript | // @target: es2018
// @lib: esnext
// @noEmit: true
async function * inferReturnType1() {
}
async function * inferReturnType2() {
yield;
}
async function * inferReturnType3() {
yield 1;
}
async function * inferReturnType4() {
yield Promise.resolve(1);
}
async function * inferReturnType5() {
yield 1;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/types.asyncGenerators.es2018.2.ts | TypeScript | // @target: es2018
// @lib: esnext
// @noEmit: true
async function * inferReturnType1() {
yield* {};
}
async function * inferReturnType2() {
yield* inferReturnType2();
}
async function * inferReturnType3() {
yield* Promise.resolve([1, 2]);
}
const assignability1: () => AsyncIterableIterator<number> = async ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/types.forAwait.es2018.1.ts | TypeScript | // @target: es2018
// @lib: esnext
// @noEmit: true
declare const asyncIterable: AsyncIterable<number>;
declare const iterable: Iterable<number>;
declare const iterableOfPromise: Iterable<Promise<number>>;
async function f1() {
let y: number;
for await (const x of asyncIterable) {
}
for await (const x o... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/types.forAwait.es2018.2.ts | TypeScript | // @target: es2018
// @lib: esnext
// @noEmit: true
declare const asyncIterable: AsyncIterable<number>;
declare const iterable: Iterable<number>;
async function f() {
let y: number;
let z: string;
for await (const x of {}) {
}
for await (y of {}) {
}
for await (z of asyncIterable) {
}
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/types.forAwait.es2018.3.ts | TypeScript | // @target: es2018
// @lib: es5
// @noEmit: true
async function f1() {
let y: number;
for await (const x of {}) {
}
for await (y of {}) {
}
}
async function* f2() {
let y: number;
for await (const x of {}) {
}
for await (y of {}) {
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesOnlyExternalModuleStillHasInstance.ts | TypeScript | // @module: commonjs
// @Filename: foo_0.ts
export interface Person {
name: string;
age: number;
}
export module M2 {
export interface I2 {
x: Person;
}
}
// @Filename: foo_1.ts
import foo0 = require('./foo_0');
// Per 11.2.3, foo_0 should still be "instantiated", albeit with no members
var x: typeof foo0 = {}... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithDuplicateTypeParameters.ts | TypeScript | class C<T, T> { }
class C2<T, U, T> { }
interface I<T, T> { }
interface I2<T, U, T> { }
function f<T, T>() { }
function f2<T, U, T>() { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithOptionalProperty.ts | TypeScript | // basic uses of optional properties without errors
interface I {
foo: string;
bar?: number;
baz? (): string;
}
var a: {
foo: string;
bar?: number;
baz? (): string;
};
var b = { foo: '' };
var c = { foo: '', bar: 3 };
var d = { foo: '', bar: 3, baz: () => '' };
var i: I;
i = b;
i = c;
i = d... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithPrivateConstructor.ts | TypeScript | // @declaration: true
class C {
private constructor() { }
}
var c = new C(); // error C is private
var r: () => void = c.constructor;
class C2 {
private constructor(x: number);
private constructor(x: any) { }
}
var c2 = new C2(); // error C2 is private
var r2: (x: number) => void = c2.constructor; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithProtectedConstructor.ts | TypeScript | // @declaration: true
class C {
protected constructor() { }
}
var c = new C(); // error C is protected
var r: () => void = c.constructor;
class C2 {
protected constructor(x: number);
protected constructor(x: any) { }
}
var c2 = new C2(); // error C2 is protected
var r2: (x: number) => void = c2.construc... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithPublicConstructor.ts | TypeScript | // public is allowed on a constructor but is not meaningful
class C {
public constructor() { }
}
var c = new C();
var r: () => void = c.constructor;
class C2 {
public constructor(x: number);
public constructor(x: any) { }
}
var c2 = new C2();
var r2: (x: number) => void = c2.constructor; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithSpecializedCallSignatures.ts | TypeScript | // basic uses of specialized signatures without errors
class Base { foo: string }
class Derived1 extends Base { bar: string }
class Derived2 extends Base { baz: string }
class C {
foo(x: 'hi'): Derived1;
foo(x: 'bye'): Derived2;
foo(x: string): Base;
foo(x) {
return x;
}
}
var c = new C();... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typesWithSpecializedConstructSignatures.ts | TypeScript | // basic uses of specialized signatures without errors
class Base { foo: string }
class Derived1 extends Base { bar: string }
class Derived2 extends Base { baz: string }
class C {
constructor(x: 'hi');
constructor(x: 'bye');
constructor(x: string);
constructor(x) {
return x;
}
}
var c = ne... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/typingsLookupAmd.ts | TypeScript | // @traceResolution: true
// @noImplicitReferences: true
// @currentDirectory: /
// @module: amd
// @filename: /node_modules/@types/a/index.d.ts
export declare class A {}
// @filename: /x/node_modules/@types/b/index.d.ts
import {A} from "a";
export declare class B extends A {}
// @filename: /x/y/foo.ts
import {B} fr... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unannotatedParametersAreOptional.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: test.js
function f(x) {}
f(); // Always been ok
class C {
static m(x) {}
p = x => {}
m(x) {}
}
C.m(); // Always been ok
new C().m(); // Regression #39261
new C().p(); // Regression #39261
const obj = {
m(x) {},
p: x => {}
};
obj.m()... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/undefinedAssignableToEveryType.ts | TypeScript | class C {
foo: string;
}
var ac: C;
interface I {
foo: string;
}
var ai: I;
enum E { A }
var ae: E;
var b: number = undefined;
var c: string = undefined;
var d: boolean = undefined;
var e: Date = undefined;
var f: any = undefined;
var g: void = undefined;
var h: Object = undefined;
var i: {} = undefined;
var ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/undefinedIsSubtypeOfEverything.ts | TypeScript | // undefined is a subtype of every other types, no errors expected below
class Base {
foo: typeof undefined;
}
class D0 extends Base {
foo: any;
}
class DA extends Base {
foo: typeof undefined;
}
class D1 extends Base {
foo: string;
}
class D1A extends Base {
foo: String;
}
class D2 extends... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions01_ES5.ts | TypeScript | // @target: es5
var x = /\u{0}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions01_ES6.ts | TypeScript | // @target: es6
var x = /\u{0}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions02_ES5.ts | TypeScript | // @target: es5
var x = /\u{00}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions02_ES6.ts | TypeScript | // @target: es6
var x = /\u{00}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions03_ES5.ts | TypeScript | // @target: es5
var x = /\u{0000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions03_ES6.ts | TypeScript | // @target: es6
var x = /\u{0000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions04_ES5.ts | TypeScript | // @target: es5
var x = /\u{00000000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions04_ES6.ts | TypeScript | // @target: es6
var x = /\u{00000000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions05_ES5.ts | TypeScript | // @target: es5
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions05_ES6.ts | TypeScript | // @target: es6
var x = /\u{48}\u{65}\u{6c}\u{6c}\u{6f}\u{20}\u{77}\u{6f}\u{72}\u{6c}\u{64}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions06_ES5.ts | TypeScript | // @target: es5
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = /\u{10FFFF}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions06_ES6.ts | TypeScript | // @target: es6
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = /\u{10FFFF}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions07_ES5.ts | TypeScript | // @target: es5
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = /\u{110000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions07_ES6.ts | TypeScript | // @target: es6
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
var x = /\u{110000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions08_ES5.ts | TypeScript | // @target: es5
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. If cp ≤ 65535, return cp.
// (FFFF == 65535)
var x = /\u{FFFF}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions08_ES6.ts | TypeScript | // @target: es6
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. If cp ≤ 65535, return cp.
// (FFFF == 65535)
var x = /\u{FFFF}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions09_ES5.ts | TypeScript | // @target: es5
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. If cp ≤ 65535, return cp.
// (10000 == 65536)
var x = /\u{10000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions09_ES6.ts | TypeScript | // @target: es6
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. If cp ≤ 65535, return cp.
// (10000 == 65536)
var x = /\u{10000}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions10_ES5.ts | TypeScript | // @target: es5
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
// Although we should just get back a single code point value of 0xD800,
// this is a useful edge-case test.
var x = /\u{D800}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unicodeExtendedEscapesInRegularExpressions10_ES6.ts | TypeScript | // @target: es6
// ES6 Spec - 10.1.1 Static Semantics: UTF16Encoding (cp)
// 2. Let cu1 be floor((cp – 65536) / 1024) + 0xD800.
// Although we should just get back a single code point value of 0xD800,
// this is a useful edge-case test.
var x = /\u{D800}/g;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.