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/unionTypeReduction.ts | TypeScript | interface I2 {
(): number;
(q): boolean;
}
interface I3 {
(): number;
}
var i2: I2, i3: I3;
var e1: I2 | I3;
var e2 = i2 || i3; // Type of e2 immediately reduced to I3
var r1 = e1(); // Type of e1 reduced to I3 upon accessing property or signature
var r2 = e2();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unionTypeReduction2.ts | TypeScript | // @strict: true
function f1(x: { f(): void }, y: { f(x?: string): void }) {
let z = !!true ? x : y; // { f(x?: string): void }
z.f();
z.f('hello');
}
function f2(x: { f(x: string | undefined): void }, y: { f(x?: string): void }) {
let z = !!true ? x : y; // { f(x?: string): void }
z.f();
z.... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unionTypeWithIndexSignature.ts | TypeScript | // @target: esnext
// @strict: true
type Two = { foo: { bar: true }, baz: true } | { [s: string]: string };
declare var u: Two
u.foo = 'bye'
u.baz = 'hi'
type Three = { foo: number } | { [s: string]: string } | { [s: string]: boolean };
declare var v: Three
v.foo = false
type Missing = { foo: number, bar: true } | { [s... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unionTypesAssignability.ts | TypeScript | var unionNumberString: number | string;
class C { }
class D extends C { foo1() { } }
class E extends C { foo2() { } }
var unionDE: D | E;
var num: number;
var str: string;
var c: C;
var d: D;
var e: E;
// A union type U is assignable to a type T if each type in U is assignable to T
c = d;
c = e;
c = unionDE; // ok
d... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unionsOfTupleTypes1.ts | TypeScript | // @strict: true
type T1 = [string, number];
type T2 = [boolean] | [string, number];
type T3 = [string, ...number[]];
type T4 = [boolean] | [string, ...number[]];
type T10 = T1[0]; // string
type T11 = T1[1]; // number
type T12 = T1[2]; // undefined
type T1N = T1[number]; // string | number
type T20 = T2[0]; //... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/uniqueSymbols.ts | TypeScript | // @target: esnext
// @lib: esnext
// @declaration: false
// @useDefineForClassFields: false
// declarations with call initializer
const constCall = Symbol();
let letCall = Symbol();
var varCall = Symbol();
// ambient declaration with type
declare const constType: unique symbol;
// declaration with type and call ini... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/uniqueSymbolsDeclarations.ts | TypeScript | // @target: esnext
// @lib: esnext
// @declaration: true
// @useDefineForClassFields: false
// declarations with call initializer
const constCall = Symbol();
let letCall = Symbol();
var varCall = Symbol();
// ambient declaration with type
declare const constType: unique symbol;
// declaration with type and call init... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/uniqueSymbolsDeclarationsErrors.ts | TypeScript | // @target: esnext
// @lib: esnext
// @module: commonjs
// @declaration: true
// @useDefineForClassFields: false
declare const s: unique symbol;
interface I { readonly readonlyType: unique symbol; }
// not allowed when emitting declarations
export const obj = {
method1(p: typeof s): typeof s {
return p;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/uniqueSymbolsDeclarationsInJs.ts | TypeScript | // @target: esnext
// @lib: esnext
// @declaration: true
// @allowJs: true
// @checkJs: true
// @filename: uniqueSymbolsDeclarationsInJs.js
// @outFile: uniqueSymbolsDeclarationsInJs-out.js
// @useDefineForClassFields: false
// classes
class C {
/**
* @readonly
*/
static readonlyStaticCall = Symbol()... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/uniqueSymbolsDeclarationsInJsErrors.ts | TypeScript | // @target: esnext
// @lib: esnext
// @declaration: true
// @allowJs: true
// @checkJs: true
// @filename: uniqueSymbolsDeclarationsInJsErrors.js
// @outFile: uniqueSymbolsDeclarationsInJsErrors-out.js
// @useDefineForClassFields: false
class C {
/**
* @type {unique symbol}
*/
static readwriteStaticT... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unknownControlFlow.ts | TypeScript | // @strict: true
// @declaration: true
type T01 = {} & string; // {} & string
type T02 = {} & 'a'; // 'a'
type T03 = {} & object; // object
type T04 = {} & { x: number }; // { x: number }
type T05 = {} & null; // never
type T06 = {} & undefined; // never
type T07 = undefined & void; // undefined
type T10 = str... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unknownType1.ts | TypeScript | // @strict: true
// In an intersection everything absorbs unknown
type T00 = unknown & null; // null
type T01 = unknown & undefined; // undefined
type T02 = unknown & null & undefined; // never
type T03 = unknown & string; // string
type T04 = unknown & string[]; // string[]
type T05 = unknown & unknown; // unk... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/unknownType2.ts | TypeScript | // @strict: true
type isUnknown<T> = unknown extends T ? true : false;
type isTrue<T extends true> = T;
type SomeResponse = 'yes' | 'no' | 'idk';
let validate: (x: unknown) => SomeResponse = x => (x === 'yes' || x === 'no') ? x : 'idk'; // No error
const u: unknown = undefined;
declare const symb: unique symbol;
de... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/untypedModuleImport_allowJs.ts | TypeScript | // @noImplicitReferences: true
// @currentDirectory: /
// @allowJs: true
// @maxNodeModuleJsDepth: 1
// Same as untypedModuleImport.ts but with --allowJs, so the package will actually be typed.
// @filename: /node_modules/foo/index.js
exports.default = { bar() { return 0; } }
// @filename: /a.ts
import foo from "foo"... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useObjectValuesAndEntries1.ts | TypeScript | // @target: es5
// @lib: es5,es2017.object
var o = { a: 1, b: 2 };
for (var x of Object.values(o)) {
let y = x;
}
var entries = Object.entries(o); // [string, number][]
var values = Object.values(o); // number[]
var entries1 = Object.entries(1); // [stri... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useObjectValuesAndEntries2.ts | TypeScript | // @target: es5
// @lib: es5
var o = { a: 1, b: 2 };
for (var x of Object.values(o)) {
let y = x;
}
var entries = Object.entries(o); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useObjectValuesAndEntries3.ts | TypeScript | // @target: es6
var o = { a: 1, b: 2 };
for (var x of Object.values(o)) {
let y = x;
}
var entries = Object.entries(o); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useObjectValuesAndEntries4.ts | TypeScript | // @target: es6
// @lib: es2017
var o = { a: 1, b: 2 };
for (var x of Object.values(o)) {
let y = x;
}
var entries = Object.entries(o); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usePromiseFinally.ts | TypeScript | // @target: es5
// @lib: es6,es2018
let promise1 = new Promise(function(resolve, reject) {})
.finally(function() {});
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useRegexpGroups.ts | TypeScript | // @target: es5
// @lib: es6,es2018
let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/u;
let result = re.exec("2015-01-02");
let date = result[0];
let year1 = result.groups.year;
let year2 = result[1];
let month1 = result.groups.month;
let month2 = result[2];
let day1 = result.groups.day;
let day2 = result[3]... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer1.ts | TypeScript | // @target: es5
// @lib: es5,es2017.sharedmemory
var foge = new SharedArrayBuffer(1024);
var bar = foge.slice(1, 10);
var len = foge.byteLength; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer2.ts | TypeScript | // @target: es5
// @lib: es5
var foge = new SharedArrayBuffer(1024);
var bar = foge.slice(1, 10);
var len = foge.byteLength; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer3.ts | TypeScript | // @target: es6
var foge = new SharedArrayBuffer(1024);
var bar = foge.slice(1, 10);
var len = foge.byteLength; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer4.ts | TypeScript | // @target: es6
// @lib: es2017
var foge = new SharedArrayBuffer(1024);
var bar = foge.slice(1, 10);
var species = foge[Symbol.species];
var stringTag = foge[Symbol.toStringTag];
var len = foge.byteLength; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer5.ts | TypeScript | // @target: es5
// @lib: es6,es2017.sharedmemory
var foge = new SharedArrayBuffer(1024);
var species = foge[Symbol.species];
var stringTag = foge[Symbol.toStringTag]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/useSharedArrayBuffer6.ts | TypeScript | // @target: es5
// @lib: es6,es2017.sharedmemory
var foge = new SharedArrayBuffer(1024);
foge.length; // should error
var length = SharedArrayBuffer.length;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.1.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
using d1 = { [Symbol.dispose]() {} };
function f() {
using d2 = { [Symbol.dispose]() {} };
}
async function af() {
using d3 = { [Symbol.dispose]() {} };
await null;
}
function * g() {
using d4 ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.11.ts | TypeScript | // @target: es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
class A {}
class C1 extends A {
constructor() {
using x = null;
super();
}
}
class C2 extends A {
constructor() {
super();
using x = null;
}
}
class C3 extends A {
y = 1;
constructor()... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.12.ts | TypeScript | // @target: es2018
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
// @useDefineForClassFields: *
class C1 {
constructor() {}
}
class C2 extends C1 {
y = 1;
constructor() {
super();
using d17 = { [Symbol.dispose]() {} };
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.14.ts | TypeScript | // @target: esnext
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
using x = {}; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.15.ts | TypeScript | // @target: esnext
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
// @noUnusedLocals: true
export {};
using _ = { [Symbol.dispose]() {} }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.2.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
{
using d1 = { [Symbol.dispose]() {} },
d2 = { [Symbol.dispose]() {} };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.3.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
{
using d1 = { [Symbol.dispose]() {} },
d2 = null,
d3 = undefined,
d4 = { [Symbol.dispose]() {} };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.4.ts | TypeScript | // @target: esnext
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
{
using [a] = null;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarations.9.ts | TypeScript | // @target: esnext
// @module: esnext
// @lib: es2022
// @noTypesAndSymbols: true
{
using a = null;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsDeclarationEmit.1.ts | TypeScript | // @target: esnext
// @module: esnext
// @declaration: true
// @noTypesAndSymbols: true
using r1 = { [Symbol.dispose]() {} };
export { r1 };
await using r2 = { async [Symbol.asyncDispose]() {} };
export { r2 };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsDeclarationEmit.2.ts | TypeScript | // @target: esnext
// @module: esnext
// @declaration: true
// @noTypesAndSymbols: true
using r1 = { [Symbol.dispose]() {} };
export type R1 = typeof r1;
await using r2 = { async [Symbol.asyncDispose]() {} };
export type R2 = typeof r2;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsInFor.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
for (using d1 = { [Symbol.dispose]() {} }, d2 = null, d3 = undefined;;) {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsInForAwaitOf.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
async function main() {
for await (using d1 of [{ [Symbol.dispose]() {} }, null, undefined]) {
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsInForOf.1.ts | TypeScript | // @target: esnext,es2022,es2017,es2015,es5
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
for (using d1 of [{ [Symbol.dispose]() {} }, null, undefined]) {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsNamedEvaluationDecoratorsAndClassFields.ts | TypeScript | // @target: es2018
// @module: esnext
// @lib: esnext
// @noTypesAndSymbols: true
export {};
declare var dec: any;
using C1 = class {
static [Symbol.dispose]() {}
};
using C2 = class {
static x = 1;
static [Symbol.dispose]() {}
};
using C3 = @dec class {
static [Symbol.dispose]() {}
};
using C4 = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsTopLevelOfModule.1.ts | TypeScript | // @target: es2022
// @lib: esnext,dom
// @module: commonjs,system,esnext,amd
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export const x = 1;
export { y };
using z = { [Symbol.dispose]() {} };
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/usingDeclarationsTopLevelOfModule.2.ts | TypeScript | // @target: es2022
// @lib: esnext,dom
// @module: commonjs,amd
// @noTypesAndSymbols: true
// @noEmitHelpers: true
using z = { [Symbol.dispose]() {} };
const y = 2;
console.log(y, z);
export = 4;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsTopLevelOfModule.3.ts | TypeScript | // @target: es2022
// @lib: esnext,dom
// @module: commonjs,system,esnext,amd
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export { y };
using z = { [Symbol.dispose]() {} };
if (false) {
var y = 1;
}
function f() {
console.log(y, z);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.1.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.10.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export default class {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.11.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
export { C };
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.12.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
export { C as D };
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.2.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export class C {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.3.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export default class C {
}
void C; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.4.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export default class {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.5.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
export { C }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.6.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
export { C as D }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.7.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.8.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export class C {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithESClassDecorators.9.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: false
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export default class C {
}
void C;
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithImportHelpers.ts | TypeScript | // @target: es2022
// @module: esnext
// @lib: esnext
// @importHelpers: true
// @noTypesAndSymbols: true
export {};
{
using a = null;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.1.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.10.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export default class {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.11.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
export { C };
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.12.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
export { C as D };
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.2.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export class C {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.3.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export default class C {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.4.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
export default class {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.5.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
export { C }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.6.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
using before = null;
@dec
class C {
}
export { C as D }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.7.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
class C {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.8.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export class C {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/usingDeclarationsWithLegacyClassDecorators.9.ts | TypeScript | // @target: esnext,es2015,es5
// @module: commonjs,system,esnext
// @lib: esnext
// @experimentalDecorators: true
// @noTypesAndSymbols: true
// @noEmitHelpers: true
export {};
declare var dec: any;
@dec
export default class C {
}
using after = null;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validBooleanAssignments.ts | TypeScript | var x = true;
var a: any = x;
var b: Object = x;
var c: Boolean = x;
var d: boolean = x; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validEnumAssignments.ts | TypeScript | enum E {
A,
B
}
var n: number;
var a: any;
var e: E;
n = e;
n = E.A;
a = n;
a = e;
a = E.A;
e = e;
e = E.A;
e = E.B;
e = n;
e = null;
e = undefined;
e = 1;
e = 1.;
e = 1.0;
e = -1; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validMultipleVariableDeclarations.ts | TypeScript | // all expected to be valid
var x: number;
var x = 2;
if (true) {
var x = 3;
for (var x = 0; ;) { }
}
var x = <number>undefined;
// new declaration space, making redeclaring x as a string valid
function declSpace() {
var x = 'this is a string';
}
interface Point { x: number; y: number; }
var p: Point;
v... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validNullAssignments.ts | TypeScript | var a: number = null;
var b: boolean = null;
var c: string = null;
var d: void = null;
var e: typeof undefined = null;
e = null; // ok
enum E { A }
E.A = null; // error
class C { foo: string }
var f: C;
f = null; // ok
C = null; // error
interface I { foo: string }
var g: I;
g = null; // ok
I = null; // error
modu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validNumberAssignments.ts | TypeScript | var x = 1;
var a: any = x;
var b: Object = x;
var c: number = x;
enum E { A };
var d: E = x;
var e = E.A;
e = x; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validStringAssignments.ts | TypeScript | var x = '';
var a: any = x;
var b: Object = x;
var c: string = x;
var d: String = x; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validUndefinedAssignments.ts | TypeScript | var x: typeof undefined;
var a: number = x;
var b: boolean = x;
var c: string = x;
var d: void = x;
var e: typeof undefined = x;
e = x; // should work
class C { foo: string }
var f: C;
f = x;
interface I { foo: string }
var g: I;
g = x;
var h: { f(): void } = x;
function i<T>(a: T) {
a = x;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validUndefinedValues.ts | TypeScript | var x: typeof undefined;
x = undefined; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validVoidAssignments.ts | TypeScript | var x: void;
var y: any;
var z: void;
y = x;
x = y;
x = z; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/validVoidValues.ts | TypeScript | var x: void;
x = undefined;
x = null; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/valuesMergingAcrossModules.ts | TypeScript | // @Filename: a.ts
function A() {}
export { A };
// @Filename: b.ts
import { A } from "./a";
type A = 0;
export { A };
// @Filename: c.ts
import { A } from "./b";
namespace A {
export const displayName = "A";
}
A();
A.displayName;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/varRequireFromJavascript.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @noEmit: true
// @Filename: ex.js
export class Crunch {
/** @param {number} n */
constructor(n) {
this.n = n
}
m() {
return this.n
}
}
// @Filename: use.js
var ex = require('./ex')
// values work
var crunch = new ex.Crunch(1);... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/varRequireFromTypescript.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @noEmit: true
// @Filename: ex.d.ts
export type Greatest = { day: 1 }
export class Crunch {
n: number
m(): number
constructor(n: number)
}
// @Filename: use.js
var ex = require('./ex')
// values work
var crunch = new ex.Crunch(1);
crunch.n
// types... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/variadicTuples1.ts | TypeScript | // @strict: true
// @declaration: true
// Variadics in tuple types
type TV0<T extends unknown[]> = [string, ...T];
type TV1<T extends unknown[]> = [string, ...T, number];
type TV2<T extends unknown[]> = [string, ...T, number, ...T];
type TV3<T extends unknown[]> = [string, ...T, ...number[], ...T];
// Normalization
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/variance.ts | TypeScript | // @strict: true
// Test cases for parameter variances affected by conditional types.
// Repro from #30047
interface Foo<T> {
prop: T extends unknown ? true : false;
}
const foo = { prop: true } as const;
const x: Foo<1> = foo;
const y: Foo<number> = foo;
const z: Foo<number> = x;
// Repro from #30118
class Ba... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxCompat.ts | TypeScript | // @verbatimModuleSyntax: true
// @isolatedModules: true
// @preserveValueImports: true
// @importsNotUsedAsValues: error
// @module: system
// @noEmit: true
// @noTypesAndSymbols: true
export {}; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxConstEnum.ts | TypeScript | // @verbatimModuleSyntax: true
// @module: esnext
export const enum E {
A = 1,
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxConstEnumUsage.ts | TypeScript | // @module: esnext
// @verbatimModuleSyntax: true
// @filename: foo.ts
export enum Foo {
a = 1,
b,
c,
}
// @filename: bar.ts
import {Foo} from './foo.js';
export enum Bar {
a = Foo.a,
c = Foo.c,
e = 5,
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxInternalImportEquals.ts | TypeScript | // @verbatimModuleSyntax: true
// @module: esnext
export {};
import f1 = NonExistent;
namespace Foo {
export const foo = 1;
export type T = any;
}
import f2 = Foo.foo;
import f3 = Foo.T;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxNoElisionCJS.ts | TypeScript | // @verbatimModuleSyntax: true
// @target: esnext
// @module: commonjs
// @moduleResolution: node
// @Filename: /a.ts
interface I {}
export = I;
// @Filename: /b.ts
import I = require("./a");
// @Filename: /c.ts
interface I {}
namespace I {
export const x = 1;
}
export = I;
// @Filename: /d.ts
import I = requir... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxNoElisionESM.ts | TypeScript | // @verbatimModuleSyntax: true
// @module: esnext
// @moduleResolution: node
// @Filename: /a.ts
export const a = 0;
export type A = typeof a;
export class AClass {}
// @Filename: /b.ts
import { a, A, AClass } from "./a";
import type { a as aValue, A as AType } from "./a";
import { type A as AType2 } from "./a";
exp... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxRestrictionsCJS.ts | TypeScript | // @verbatimModuleSyntax: true
// @target: esnext
// @module: commonjs
// @moduleResolution: node
// @esModuleInterop: true
// @Filename: /decl.d.ts
declare function esmy(): void;
export default esmy;
export declare function funciton(): void;
// @Filename: /ambient.d.ts
declare module "ambient" {
const _default: ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/verbatimModuleSyntaxRestrictionsESM.ts | TypeScript | // @verbatimModuleSyntax: true
// @target: esnext
// @module: esnext
// @moduleResolution: node
// @esModuleInterop: true, false
// @Filename: /decl.d.ts
declare class CJSy {}
export = CJSy;
// @Filename: /ambient.d.ts
declare module "ambient" {
const _export: number;
export = _export;
}
// @Filename: /types... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidOperatorWithAnyOtherType.ts | TypeScript | // void operator on any type
var ANY: any;
var ANY1;
var ANY2: any[] = ["", ""];
var obj: () => {}
var obj1 = {x:"",y:1};
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 objA = new A();
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidOperatorWithBooleanType.ts | TypeScript | // void 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 ResultIsAny1 = void BOOLEAN;
// boolean type literal
var ResultI... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidOperatorWithEnumType.ts | TypeScript | // void operator on enum type
enum ENUM { };
enum ENUM1 { A, B, "" };
// enum type var
var ResultIsAny1 = void ENUM;
var ResultIsAny2 = void ENUM1;
// enum type expressions
var ResultIsAny3 = void ENUM1["A"];
var ResultIsAny4 = void (ENUM[0] + ENUM1["B"]);
// multiple void operators
var ResultIsAny5 = void void E... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidOperatorWithNumberType.ts | TypeScript | // void 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 ResultIsAny1 = void NUMBER;
var ResultIsAny2 = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidOperatorWithStringType.ts | TypeScript | // void 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 ResultIsAny1 = void STRING;
var Resul... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/voidParamAssignmentCompatibility.ts | TypeScript | // @strict: true
declare function g(a: void): void;
let gg: () => void = g;
interface Obj<T> {
method(value: T): void;
}
declare const o: Obj<void>;
gg = o.method;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/weakTypesAndLiterals01.ts | TypeScript | // @strict: true
// @declaration: true
// @emitDeclarationOnly: true
type WeakTypes =
| { optional?: true; }
| { toLowerCase?(): string }
| { toUpperCase?(): string, otherOptionalProp?: number };
type LiteralsOrWeakTypes =
| "A"
| "B"
| WeakTypes;
declare let aOrB: "A" | "B";
const f = (arg:... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/whileBreakStatements.ts | TypeScript | // @allowUnusedLabels: true
// @allowUnreachableCode: true
while(true) {
break;
}
ONE:
while (true) {
break ONE;
}
TWO:
THREE:
while (true) {
break THREE;
}
FOUR:
while (true) {
FIVE:
while (true) {
break FOUR;
}
}
while (true) {
SIX:
while (true)
break SIX;
}
SEV... | 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.