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/emitExponentiationOperatorInTemplateString3ES6.ts | TypeScript | // @target: es6
var t1 = 10;
var t2 = 10;
var s;
// With TemplateTail
`${t1 ** t2} world`;
`${t1 ** t2 ** t1} world`;
`${t1 + t2 ** t1} world`;
`${t1 ** t2 + t1} world`;
`${t1 + t2 ** t2 + t1 } world`;
`${typeof (t1 ** t2 ** t1) } world`;
`${1 + typeof (t1 ** t2 ** t1) } world`;
`${t1 ** t2}${t1 ** t2} world`;
`${t... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunction.ts | TypeScript | // @target: es5
function bar(...rest) { }
function foo(x: number, y: string, ...rest) { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunctionES6.ts | TypeScript | // @target: es6
function bar(...rest) { }
function foo(x: number, y: string, ...rest) { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunctionExpression.ts | TypeScript | // @target: es5
var funcExp = (...rest) => { }
var funcExp1 = (X: number, ...rest) => { }
var funcExp2 = function (...rest) { }
var funcExp3 = (function (...rest) { })()
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunctionExpressionES6.ts | TypeScript | // @target: es6
var funcExp = (...rest) => { }
var funcExp1 = (X: number, ...rest) => { }
var funcExp2 = function (...rest) { }
var funcExp3 = (function (...rest) { })() | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunctionProperty.ts | TypeScript | // @target: es5
var obj: {
func1: (...rest) => void
}
var obj2 = {
func(...rest) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersFunctionPropertyES6.ts | TypeScript | // @target: es6
var obj: {
func1: (...rest) => void
}
var obj2 = {
func(...rest) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersMethod.ts | TypeScript | // @target: es5
class C {
constructor(name: string, ...rest) { }
public bar(...rest) { }
public foo(x: number, ...rest) { }
}
class D {
constructor(...rest) { }
public bar(...rest) { }
public foo(x: number, ...rest) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitRestParametersMethodES6.ts | TypeScript | // @target: es6
class C {
constructor(name: string, ...rest) { }
public bar(...rest) { }
public foo(x: number, ...rest) { }
}
class D {
constructor(...rest) { }
public bar(...rest) { }
public foo(x: number, ...rest) { }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitStatementsBeforeSuperCall.ts | TypeScript | // @useDefineForClassFields: false
// @target: es2015
class Base {
}
class Sub extends Base {
// @ts-ignore
constructor(public p: number) {
console.log('hi'); // should emit before super
super();
}
field = 0;
}
class Test extends Base {
prop: number;
// @ts-ignore
construct... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitStatementsBeforeSuperCallWithDefineFields.ts | TypeScript | // @useDefineForClassFields: true
// @target: es2015
class Base {
}
class Sub extends Base {
// @ts-ignore
constructor(public p: number) {
console.log('hi');
super();
}
field = 0;
}
class Test extends Base {
prop: number;
// @ts-ignore
constructor(public p: number) {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.classMethods.es2015.ts | TypeScript | // @target: es2015
// @lib: esnext
// @filename: C1.ts
class C1 {
async * f() {
}
}
// @filename: C2.ts
class C2 {
async * f() {
const x = yield;
}
}
// @filename: C3.ts
class C3 {
async * f() {
const x = yield 1;
}
}
// @filename: C4.ts
class C4 {
async * f() {
const... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.classMethods.es2018.ts | TypeScript | // @target: es2018
// @lib: esnext
// @filename: C1.ts
class C1 {
async * f() {
}
}
// @filename: C2.ts
class C2 {
async * f() {
const x = yield;
}
}
// @filename: C3.ts
class C3 {
async * f() {
const x = yield 1;
}
}
// @filename: C4.ts
class C4 {
async * f() {
const... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.classMethods.es5.ts | TypeScript | // @target: es5
// @lib: esnext
// @filename: C1.ts
class C1 {
async * f() {
}
}
// @filename: C2.ts
class C2 {
async * f() {
const x = yield;
}
}
// @filename: C3.ts
class C3 {
async * f() {
const x = yield 1;
}
}
// @filename: C4.ts
class C4 {
async * f() {
const x ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionDeclarations.es2015.ts | TypeScript | // @target: es2015
// @lib: esnext
// @filename: F1.ts
async function * f1() {
}
// @filename: F2.ts
async function * f2() {
const x = yield;
}
// @filename: F3.ts
async function * f3() {
const x = yield 1;
}
// @filename: F4.ts
async function * f4() {
const x = yield* [1];
}
// @filename: F5.ts
async funct... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionDeclarations.es2018.ts | TypeScript | // @target: es2018
// @lib: esnext
// @filename: F1.ts
async function * f1() {
}
// @filename: F2.ts
async function * f2() {
const x = yield;
}
// @filename: F3.ts
async function * f3() {
const x = yield 1;
}
// @filename: F4.ts
async function * f4() {
const x = yield* [1];
}
// @filename: F5.ts
async funct... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionDeclarations.es5.ts | TypeScript | // @target: es5
// @lib: esnext
// @filename: F1.ts
async function * f1() {
}
// @filename: F2.ts
async function * f2() {
const x = yield;
}
// @filename: F3.ts
async function * f3() {
const x = yield 1;
}
// @filename: F4.ts
async function * f4() {
const x = yield* [1];
}
// @filename: F5.ts
async function... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionExpressions.es2015.ts | TypeScript | // @target: es2015
// @lib: esnext
// @filename: F1.ts
const f1 = async function * () {
}
// @filename: F2.ts
const f2 = async function * () {
const x = yield;
}
// @filename: F3.ts
const f3 = async function * () {
const x = yield 1;
}
// @filename: F4.ts
const f4 = async function * () {
const x = yield* [1... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionExpressions.es2018.ts | TypeScript | // @target: es2018
// @lib: esnext
// @filename: F1.ts
const f1 = async function * () {
}
// @filename: F2.ts
const f2 = async function * () {
const x = yield;
}
// @filename: F3.ts
const f3 = async function * () {
const x = yield 1;
}
// @filename: F4.ts
const f4 = async function * () {
const x = yield* [1... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.functionExpressions.es5.ts | TypeScript | // @target: es5
// @lib: esnext
// @filename: F1.ts
const f1 = async function * () {
}
// @filename: F2.ts
const f2 = async function * () {
const x = yield;
}
// @filename: F3.ts
const f3 = async function * () {
const x = yield 1;
}
// @filename: F4.ts
const f4 = async function * () {
const x = yield* [1];
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.objectLiteralMethods.es2015.ts | TypeScript | // @target: es2015
// @lib: esnext
// @filename: O1.ts
const o1 = {
async * f() {
}
}
// @filename: O2.ts
const o2 = {
async * f() {
const x = yield;
}
}
// @filename: O3.ts
const o3 = {
async * f() {
const x = yield 1;
}
}
// @filename: O4.ts
const o4 = {
async * f() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.objectLiteralMethods.es2018.ts | TypeScript | // @target: es2018
// @lib: esnext
// @filename: O1.ts
const o1 = {
async * f() {
}
}
// @filename: O2.ts
const o2 = {
async * f() {
const x = yield;
}
}
// @filename: O3.ts
const o3 = {
async * f() {
const x = yield 1;
}
}
// @filename: O4.ts
const o4 = {
async * f() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.asyncGenerators.objectLiteralMethods.es5.ts | TypeScript | // @target: es5
// @lib: esnext
// @filename: O1.ts
const o1 = {
async * f() {
}
}
// @filename: O2.ts
const o2 = {
async * f() {
const x = yield;
}
}
// @filename: O3.ts
const o3 = {
async * f() {
const x = yield 1;
}
}
// @filename: O4.ts
const o4 = {
async * f() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.forAwait.ts | TypeScript | // @target: es2018,es2017,es2015,es5
// @lib: esnext
// @filename: file1.ts
async function f1() {
let y: any;
for await (const x of y) {
}
}
// @filename: file2.ts
async function f2() {
let x: any, y: any;
for await (x of y) {
}
}
// @filename: file3.ts
async function* f3() {
let y: any;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emitter.noCatchBinding.es2019.ts | TypeScript | // @target: es2019
function f() {
try { } catch { }
try { } catch {
try { } catch { }
}
try { } catch { } finally { }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyArrayBindingPatternParameter01.ts | TypeScript | // @declaration: true
function f([]) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyArrayBindingPatternParameter02.ts | TypeScript | // @declaration: true
function f(a, []) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyArrayBindingPatternParameter03.ts | TypeScript | // @declaration: true
function f(a, []) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyArrayBindingPatternParameter04.ts | TypeScript | // @declaration: true
function f([] = [1,2,3,4]) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns01_ES5.ts | TypeScript | // @target: es5
// @declaration: true
var a: any;
({} = a);
([] = a);
var [,] = [1,2]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns01_ES5iterable.ts | TypeScript | // @target: es5
// @declaration: true
// @downlevelIteration: true
var a: any;
({} = a);
([] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns01_ES6.ts | TypeScript | // @target: es6
// @declaration: true
var a: any;
({} = a);
([] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns02_ES5.ts | TypeScript | // @target: es5
// @declaration: true
var a: any;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [ a1, a2, a3] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns02_ES5iterable.ts | TypeScript | // @target: es5
// @declaration: true
// @downlevelIteration: true
var a: any;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [ a1, a2, a3] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns02_ES6.ts | TypeScript | // @target: es6
// @declaration: true
var a: any;
let x, y, z, a1, a2, a3;
({} = { x, y, z } = a);
([] = [ a1, a2, a3] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns03_ES5.ts | TypeScript | // @target: es5
// @declaration: true
var a: any;
({} = {} = a);
([] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns03_ES5iterable.ts | TypeScript | // @target: es5
// @declaration: true
// @downlevelIteration: true
var a: any;
({} = {} = a);
([] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns03_ES6.ts | TypeScript | // @target: es6
// @declaration: true
var a: any;
({} = {} = a);
([] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns04_ES5.ts | TypeScript | // @target: es5
// @declaration: true
var a: any;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([ a1, a2, a3] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns04_ES5iterable.ts | TypeScript | // @target: es5
// @declaration: true
// @downlevelIteration: true
var a: any;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([ a1, a2, a3] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyAssignmentPatterns04_ES6.ts | TypeScript | // @target: es6
// @declaration: true
var a: any;
let x, y, z, a1, a2, a3;
({ x, y, z } = {} = a);
([ a1, a2, a3] = [] = a); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyObjectBindingPatternParameter01.ts | TypeScript | // @declaration: true
function f({}) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyObjectBindingPatternParameter02.ts | TypeScript | // @declaration: true
function f(a, {}) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyObjectBindingPatternParameter03.ts | TypeScript | // @declaration: true
function f({}, a) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyObjectBindingPatternParameter04.ts | TypeScript | // @declaration: true
function f({} = {a: 1, b: "2", c: true}) {
var x, y, z;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyTuplesTypeAssertion01.ts | TypeScript | // @declaration: true
let x = <[]>[];
let y = x[0]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyTuplesTypeAssertion02.ts | TypeScript | // @declaration: true
let x = [] as [];
let y = x[0]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyVariableDeclarationBindingPatterns01_ES5.ts | TypeScript | // @target: es5
(function () {
var a: any;
var {} = a;
let {} = a;
const {} = a;
var [] = a;
let [] = a;
const [] = a;
var {} = a, [] = a;
let {} = a, [] = a;
const {} = a, [] = a;
var { p1: {}, p2: [] } = a;
let { p1: {}, p2: [] } = a;
const { p1: {}, p2: [] } =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyVariableDeclarationBindingPatterns01_ES5iterable.ts | TypeScript | // @target: es5
// @downlevelIteration: true
(function () {
var a: any;
var {} = a;
let {} = a;
const {} = a;
var [] = a;
let [] = a;
const [] = a;
var {} = a, [] = a;
let {} = a, [] = a;
const {} = a, [] = a;
var { p1: {}, p2: [] } = a;
let { p1: {}, p2: [] } = a;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/emptyVariableDeclarationBindingPatterns01_ES6.ts | TypeScript | // @target: es6
(function () {
var a: any;
var {} = a;
let {} = a;
const {} = a;
var [] = a;
let [] = a;
const [] = a;
var {} = a, [] = a;
let {} = a, [] = a;
const {} = a, [] = a;
var { p1: {}, p2: [] } = a;
let { p1: {}, p2: [] } = a;
const { p1: {}, p2: [] } =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumAssignability.ts | TypeScript | // enums assignable to number, any, Object, errors unless otherwise noted
enum E { A }
enum F { B }
var e = E.A;
var f = F.B;
e = f;
f = e;
e = 1; // ok
f = 1; // ok
var x: number = e; // ok
x = f; // ok
module Others {
var a: any = e; // ok
class C {
foo: string;
}
var ac: C;
interfa... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumAssignabilityInInheritance.ts | TypeScript | // enum is only a subtype of number, no types are subtypes of enum, all of these except the first are errors
enum E { A }
interface I0 {
[x: string]: E;
foo: E; // identical and subtype, ok
}
declare function foo(x: E): E;
declare function foo(x: number): number;
declare function foo(x: any): any;
var r = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumBasics.ts | TypeScript | // Enum without initializers have first member = 0 and successive members = N + 1
enum E1 {
A,
B,
C
}
// Enum type is a subtype of Number
var x: number = E1.A;
// Enum object type is anonymous with properties of the enum type and numeric indexer
var e = E1;
var e: {
readonly A: E1.A;
readonly B: E... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumClassification.ts | TypeScript | // @declaration: true
// An enum type where each member has no initializer or an initializer that specififes
// a numeric literal, a string literal, or a single identifier naming another member in
// the enum type is classified as a literal enum type. An enum type that doesn't adhere
// to this pattern is classified a... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumConstantMemberWithString.ts | TypeScript | enum T1 {
a = "1",
b = "1" + "2",
c = "1" + "2" + "3",
d = "a" - "a",
e = "a" + 1
}
enum T2 {
a = "1",
b = "1" + "2"
}
enum T3 {
a = "1",
b = "1" + "2",
c = 1,
d = 1 + 2
}
enum T4 {
a = "1"
}
enum T5 {
a = "1" + "2"
}
declare enum T6 {
a = "1",
b = "1" + ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumConstantMemberWithStringEmitDeclaration.ts | TypeScript | // @declaration: true
enum T1 {
a = "1",
b = "1" + "2",
c = "1" + "2" + "3"
}
enum T2 {
a = "1",
b = "1" + "2"
}
enum T3 {
a = "1",
b = "1" + "2"
}
enum T4 {
a = "1"
}
enum T5 {
a = "1" + "2"
}
declare enum T6 {
a = "1",
b = "1" + "2"
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumConstantMemberWithTemplateLiterals.ts | TypeScript | enum T1 {
a = `1`
}
enum T2 {
a = `1`,
b = "2",
c = 3
}
enum T3 {
a = `1` + `1`
}
enum T4 {
a = `1`,
b = `1` + `1`,
c = `1` + "2",
d = "2" + `1`,
e = "2" + `1` + `1`
}
enum T5 {
a = `1`,
b = `1` + `2`,
c = `1` + `2` + `3`,
d = 1,
e = `1` - `1`,
f = `1`... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumConstantMemberWithTemplateLiteralsEmitDeclaration.ts | TypeScript | // @declaration: true
enum T1 {
a = `1`
}
enum T2 {
a = `1`,
b = "2",
c = 3
}
enum T3 {
a = `1` + `1`
}
enum T4 {
a = `1`,
b = `1` + `1`,
c = `1` + "2",
d = "2" + `1`,
e = "2" + `1` + `1`
}
enum T5 {
a = `1`,
b = `1` + `2`,
c = `1` + `2` + `3`,
d = 1
}
enum T... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumConstantMembers.ts | TypeScript | // Constant members allow negatives, but not decimals. Also hex literals are allowed
enum E1 {
a = 1,
b
}
enum E2 {
a = - 1,
b
}
enum E3 {
a = 0.1,
b // Error because 0.1 is not a constant
}
declare enum E4 {
a = 1,
b = -1,
c = 0.1 // Not a constant
}
enum E5 {
a = 1 / 0,
b... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumExportMergingES6.ts | TypeScript | // @target: es6
export enum Animals {
Cat = 1
}
export enum Animals {
Dog = 2
}
export enum Animals {
CatDog = Cat | Dog
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumIsNotASubtypeOfAnythingButNumber.ts | TypeScript | // enums are only subtypes of number, any and no other types
enum E { A }
interface I {
[x: string]: any;
foo: E; // ok
}
interface I2 {
[x: string]: number;
foo: E; // ok
}
// error cases
interface I3 {
[x: string]: string;
foo: E;
}
interface I4 {
[x: string]: boolean;
foo: E;
}
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumLiteralTypes1.ts | TypeScript | const enum Choice { Unknown, Yes, No };
type YesNo = Choice.Yes | Choice.No;
type NoYes = Choice.No | Choice.Yes;
type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No;
function f1() {
var a: YesNo;
var a: NoYes;
var a: Choice.Yes | Choice.No;
var a: Choice.No | Choice.Yes;
}
function f2(a: Yes... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumLiteralTypes2.ts | TypeScript | // @strictNullChecks: true
const enum Choice { Unknown, Yes, No };
type YesNo = Choice.Yes | Choice.No;
type NoYes = Choice.No | Choice.Yes;
type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No;
function f1() {
var a: YesNo;
var a: NoYes;
var a: Choice.Yes | Choice.No;
var a: Choice.No | Choic... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumLiteralTypes3.ts | TypeScript | const enum Choice { Unknown, Yes, No };
type Yes = Choice.Yes;
type YesNo = Choice.Yes | Choice.No;
type NoYes = Choice.No | Choice.Yes;
type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No;
function f1(a: Yes, b: YesNo, c: UnknownYesNo, d: Choice) {
a = a;
a = b;
a = c;
a = d;
}
function f2(a... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumMergeWithExpando.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: lovefield-ts.d.ts
// bug #27352, crashes from github.com/google/lovefield
declare namespace lf {
export enum Order { ASC, DESC }
}
// @Filename: enums.js
lf.Order = {}
lf.Order.DESC = 0;
lf.Order.ASC = 1;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumMerging.ts | TypeScript | // Enum with only constant members across 2 declarations with the same root module
// Enum with initializer in all declarations with constant members with the same root module
module M1 {
enum EImpl1 {
A, B, C
}
enum EImpl1 {
D = 1, E, F
}
export enum EConst1 {
A = 3, B = 2... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumMergingErrors.ts | TypeScript | // Enum with constant, computed, constant members split across 3 declarations with the same root module
module M {
export enum E1 { A = 0 }
export enum E2 { C }
export enum E3 { A = 0 }
}
module M {
export enum E1 { B = 'foo'.length }
export enum E2 { B = 'foo'.length }
export enum E3 { C }
}
mo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTag.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
/** @enum {string} */
const Target = {
START: "start",
MIDDLE: "middle",
END: "end",
MISTAKE: 1,
/** @type {number} */
OK_I_GUESS: 2
}
/** @enum number */
const Second = {
MISTAKE: "end",
OK: 1,
/** @type {number... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTagCircularReference.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: bug27142.js
/** @enum {E} */
const E = { x: 0 };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTagImported.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: type.js
/** @typedef {import("./mod1").TestEnum} TE */
/** @type {TE} */
const test = 'add'
/** @type {import("./mod1").TestEnum} */
const tost = 'remove'
// @Filename: value.js
import { TestEnum } from "./mod1"
/** @type {TestEnum} */
const tist = Tes... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTagOnExports.ts | TypeScript | // @filename: enumTagOnExports.js
// @allowjs: true
// @checkjs: true
// @noemit: true
/** @enum {number} */
exports.a = {};
/** @enum {string} */
module.exports.b = {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTagOnExports2.ts | TypeScript | // @filename: enumTagOnExports.js
// @allowjs: true
// @checkjs: true
// @noemit: true
/** @enum {string} */
module.exports = {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enumTagUseBeforeDefCrash.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: bug27134.js
/**
* @enum {number}
*/
var foo = { };
/**
* @type {foo}
*/
var s;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/enums.ts | TypeScript | // @Filename: /a.ts
enum SyntaxKind {
ImportClause,
ExportDeclaration
}
const enum SymbolFlags {
Type = "Type",
Value = "Value"
}
export type { SyntaxKind };
export { SymbolFlags };
// @Filename: /b.ts
import type { SyntaxKind, SymbolFlags } from './a';
SyntaxKind.ImportClause;
SymbolFlags.Type;
let kind: S... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/equalityWithEnumTypes.ts | TypeScript | // @strict: true
// Literal enum type
enum E1 {
a = 1,
b = 2,
}
// Numeric enum type
enum E2 {
a = 1 << 0,
b = 1 << 1
}
function f1(v: E1) {
if (v !== 0) { // Error
v;
}
if (v !== 1) {
v;
}
if (v !== 2) {
v;
}
if (v !== 3) { // Error
v;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/equalityWithIntersectionTypes01.ts | TypeScript | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/equalityWithUnionTypes01.ts | TypeScript | interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/equalityWithtNullishCoalescingAssignment.ts | TypeScript | // @strict: true, false
function f1(a?: boolean): void {
a ??= true;
if (a === false) {
console.log(a);
}
}
f1(false);
function f2() {
let x: 0 | 1 | 2 | 3 = 0 as any;
x ??= 1;
if (x === 0) {
console.log(x);
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/errorIsolation.ts | TypeScript | // @noEmit: true
// @checkJs: true
// @filename: errorIsolation.js
const async = { doSomething: _ => {} };
async.doSomething(
/***/
() => {}
); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/errorOnFunctionReturnType.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: foo.js
/**
* @callback FunctionReturningPromise
* @returns {Promise<number>}
*/
/** @type {FunctionReturningPromise} */
function testPromise1() {
console.log("Nope");
}
/** @type {FunctionReturningPromise} */
async function testPromise2() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/errorSuperCalls.ts | TypeScript | //super call in class constructor with no base type
class NoBase {
constructor() {
super();
}
//super call in class member function with no base type
fn() {
super();
}
//super call in class accessor (get and set) with no base type
get foo() {
super();
return... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/errorSuperPropertyAccess.ts | TypeScript | //super property access in constructor of class with no base type
//super property access in instance member function of class with no base type
//super property access in instance member accessor(get and set) of class with no base type
class NoBase {
constructor() {
var a = super.prototype;
var b =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2016IntlAPIs.ts | TypeScript | // @target: es2016
// Sample from
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales
console.log(Intl.getCanonicalLocales('EN-US'));
// Expected output: Array ["en-US"]
console.log(Intl.getCanonicalLocales(['EN-US', 'Fr']));
// Expected output: Array ["en-US",... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2017DateAPIs.ts | TypeScript | // @lib: es2017
Date.UTC(2017); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2018IntlAPIs.ts | TypeScript | // @target: es2018
// Sample from
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/supportedLocalesOf
const locales = ['ban', 'id-u-co-pinyin', 'de-ID'];
const options = { localeMatcher: 'lookup' } as const;
console.log(Intl.PluralRules.supportedLocalesOf(locales, op... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2020IntlAPIs.ts | TypeScript | // @target: es2020
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
const count = 26254.39;
const date = new Date("2012-05-24");
function log(locale: string) {
console.log(
`${new Intl.DateTimeFormat(locale).format(date)} ${new Intl.N... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2021LocalesObjectArgument.ts | TypeScript | // @target: es2021
const enUS = new Intl.Locale("en-US");
const deDE = new Intl.Locale("de-DE");
const jaJP = new Intl.Locale("ja-JP");
new Intl.ListFormat(enUS);
new Intl.ListFormat([deDE, jaJP]);
Intl.ListFormat.supportedLocalesOf(enUS);
Intl.ListFormat.supportedLocalesOf([deDE, jaJP]);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2022IntlAPIs.ts | TypeScript | // @target: es2022
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename
const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const;
for (const zoneName of timezoneNames) {
var format... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2022LocalesObjectArgument.ts | TypeScript | // @target: es2022
const enUS = new Intl.Locale("en-US");
const deDE = new Intl.Locale("de-DE");
const jaJP = new Intl.Locale("ja-JP");
new Intl.Segmenter(enUS);
new Intl.Segmenter([deDE, jaJP]);
Intl.Segmenter.supportedLocalesOf(enUS);
Intl.Segmenter.supportedLocalesOf([deDE, jaJP]);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es2022SharedMemory.ts | TypeScript | // @target: esnext
// @lib: es2022
// @noemit: true
// @strict: true
const sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 1024);
const int32 = new Int32Array(sab);
const sab64 = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 1024);
const int64 = new BigInt64Array(sab64);
const waitValue = Atomics.... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es5DateAPIs.ts | TypeScript | // @lib: es5
Date.UTC(2017); // should error | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekind.ts | TypeScript | // @target: ES6
// @sourcemap: false
// @declaration: false
// @module: es6
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindExportClassNameWithObject.ts | TypeScript | // @target: ES5
// @module: es2015
export class Object {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES2015Target.ts | TypeScript | // @target: es2015
// @sourcemap: false
// @declaration: false
// @module: es6
export default class A
{
constructor ()
{
}
public B()
{
return 42;
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target.ts | TypeScript | // @target: es5
// @module: es2015
// @experimentalDecorators: true
export class C {
static s = 0;
p = 1;
method() { }
}
export { C as C2 };
declare function foo(...args: any[]): any;
@foo
export class D {
static s = 0;
p = 1;
method() { }
}
export { D as D2 };
class E { }
export {E};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target10.ts | TypeScript | // @target: es5
// @module: es2015
import i = require("mod"); // Error;
namespace N {
}
export = N; // Error | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target11.ts | TypeScript | // @target: es5
// @module: es2015
// @experimentalDecorators: true
declare function foo(...args: any[]): any;
@foo
export default class C {
static x() { return C.y; }
static y = 1
p = 1;
method() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target12.ts | TypeScript | // @target: es5
// @module: es2015
export class C {
}
export namespace C {
export const x = 1;
}
export enum E {
w = 1
}
export enum E {
x = 2
}
export namespace E {
export const y = 1;
}
export namespace E {
export const z = 1;
}
export namespace N {
}
export namespace N {
export const ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target2.ts | TypeScript | // @target: es5
// @module: es2015
export default class C {
static s = 0;
p = 1;
method() { }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/es6modulekindWithES5Target3.ts | TypeScript | // @target: es5
// @module: es2015
// @experimentalDecorators: true
declare function foo(...args: any[]): any;
@foo
export default class D {
static s = 0;
p = 1;
method() { }
} | 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.