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/importCallExpressionAsyncES6CJS.ts | TypeScript | // @module: commonjs
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES6System.ts | TypeScript | // @module: system
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test')... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionAsyncES6UMD.ts | TypeScript | // @module: umd
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') //... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionCheckReturntype1.ts | TypeScript | // @module: commonjs
// @target: es6
// @noImplicitAny: true
// @filename: anotherModule.ts
export class D{}
// @filename: defaultPath.ts
export class C {}
// @filename: 1.ts
import * as defaultModule from "./defaultPath";
import * as anotherModule from "./anotherModule";
let p1: Promise<typeof anotherModule> = imp... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionDeclarationEmit1.ts | TypeScript | // @module: commonjs
// @target: es6
// @noImplicitAny: false
// @declaration: true
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
declare const directory: string;
declare const moduleFile: number;
import(getSpecifier());
var p0 = import(`${directory}\\${moduleFile}`);
var p1 = import(getS... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionDeclarationEmit2.ts | TypeScript | // @module: es2020
// @target: es2020
// @declaration: true
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
var p1 = import("./0");
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionDeclarationEmit3.ts | TypeScript | // @module: es2020
// @target: es2020
// @declaration: true
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
declare function getPath(): string;
import * as Zero from "./0";
import("./0");
export var p0: Promise<typeof Zero> = import(getPath());
export var p1: Promise<typeof Zero> = impo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES5AMD.ts | TypeScript | // @module: amd
// @target: es5
// @lib: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES5CJS.ts | TypeScript | // @module: commonjs
// @target: es5
// @lib: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES5System.ts | TypeScript | // @module: system
// @target: es5
// @lib: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES5UMD.ts | TypeScript | // @module: umd
// @target: es5
// @lib: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES6AMD.ts | TypeScript | // @module: amd
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const lo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES6CJS.ts | TypeScript | // @module: commonjs
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
con... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES6System.ts | TypeScript | // @module: system
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionES6UMD.ts | TypeScript | // @module: umd
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const lo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionErrorInES2015.ts | TypeScript | // @module: es2015
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
})
function foo() {
const p2 = import("./0");
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInAMD1.ts | TypeScript | // @module: amd
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInAMD2.ts | TypeScript | // @module: amd
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInAMD3.ts | TypeScript | // @module: amd
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
async function foo() {
class C extends (await import("./0")).B {}
var c = new C();
c.print();
}
foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInAMD4.ts | TypeScript | // @module: amd
// @target: esnext
// @useDefineForClassFields: false
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private myMod... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS1.ts | TypeScript | // @module: commonjs
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS2.ts | TypeScript | // @module: commonjs
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
async function compute(promise: Promise<any>) {
let j = await promise;
if (!j) {
j = await import("./1");
retu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS3.ts | TypeScript | // @module: commonjs
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS4.ts | TypeScript | // @module: commonjs
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
async function foo() {
class C extends (await import("./0")).B {}
var c = new C();
c.print();
}
foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInCJS5.ts | TypeScript | // @module: commonjs
// @target: esnext
// @useDefineForClassFields: false
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInExportEqualsAMD.ts | TypeScript | // @module: amd
// @target: esnext
// @filename: something.ts
export = 42;
// @filename: index.ts
export = async function() {
const something = await import("./something");
}; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInExportEqualsCJS.ts | TypeScript | // @module: commonjs
// @target: esnext
// @filename: something.ts
export = 42;
// @filename: index.ts
export = async function() {
const something = await import("./something");
}; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInExportEqualsUMD.ts | TypeScript | // @module: umd
// @target: esnext
// @filename: something.ts
export = 42;
// @filename: index.ts
export = async function() {
const something = await import("./something");
}; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInSystem1.ts | TypeScript | // @module: system
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInSystem2.ts | TypeScript | // @module: system
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInSystem3.ts | TypeScript | // @module: system
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
async function foo() {
class C extends (await import("./0")).B {}
var c = new C();
c.print();
}
foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInSystem4.ts | TypeScript | // @module: system
// @target: esnext
// @useDefineForClassFields: false
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private my... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInUMD1.ts | TypeScript | // @module: umd
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInUMD2.ts | TypeScript | // @module: umd
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInUMD3.ts | TypeScript | // @module: umd
// @target: esnext
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
// @filename: 2.ts
async function foo() {
class C extends (await import("./0")).B {}
var c = new C();
c.print();
}
foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInUMD4.ts | TypeScript | // @module: umd
// @target: esnext
// @useDefineForClassFields: false
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private myModu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionInUMD5.ts | TypeScript | // @module: umd
// @target: es2015
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
// https://github.com/microsoft/TypeScript/issues/36780
async function func() {
const packageName = '.';
const packageJson = await import(packageName + '/package.json');
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedAMD.ts | TypeScript | // @module: amd
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedAMD2.ts | TypeScript | // @module: amd
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedCJS.ts | TypeScript | // @module: commonjs
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedCJS2.ts | TypeScript | // @module: commonjs
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedES2015.ts | TypeScript | // @module: es2015
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedES20152.ts | TypeScript | // @module: es2015
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedES2020.ts | TypeScript | // @module: es2020
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedES20202.ts | TypeScript | // @module: es2020
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedSystem.ts | TypeScript | // @module: system
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedSystem2.ts | TypeScript | // @module: system
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedUMD.ts | TypeScript | // @module: umd
// @target: es6
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNestedUMD2.ts | TypeScript | // @module: umd
// @target: es5
// @skipLibCheck: true
// @lib: es6
// @filename: foo.ts
export default "./foo";
// @filename: index.ts
async function foo() {
return await import((await import("./foo")).default);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionNoModuleKindSpecified.ts | TypeScript | // @lib: es5
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsyn... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionReturnPromiseOfAny.ts | TypeScript | // @module: commonjs
// @target: es6
// @noImplicitAny: true
// @filename: defaultPath.ts
export class C {}
// @filename: 1.ts
import * as defaultModule from "./defaultPath";
declare function getSpecifier(): string;
declare function ValidSomeCondition(): boolean;
declare var whatToLoad: boolean;
declare const director... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionShouldNotGetParen.ts | TypeScript | // @module: es2020
// @target: es6
// @noImplicitAny: true
const localeName = "zh-CN";
import(`./locales/${localeName}.js`).then(bar => {
let x = bar;
});
import("./locales/" + localeName + ".js").then(bar => {
let x = bar;
});
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importCallExpressionSpecifierNotStringTypeError.ts | TypeScript | // @module: commonjs
// @target: es6
// @noImplicitAny: false
declare function getSpecifier(): boolean;
declare var whatToLoad: boolean;
// Error specifier is not assignable to string
import(getSpecifier());
var p1 = import(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
p1.then(zero =>... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importClause_default.ts | TypeScript | // @Filename: /a.ts
export default class A { a!: string }
// @Filename: /b.ts
import type A from './a';
new A();
let a: A = { a: '' };
let b = { A };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importDefaultNamedType.ts | TypeScript | // @Filename: /a.ts
export default class A {}
// @Filename: /b.ts
import type from './a';
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importElisionConstEnumMerge1.ts | TypeScript | // @Filename: enum.ts
export const enum Enum {
One = 1,
}
// @Filename: merge.ts
import { Enum } from "./enum";
namespace Enum {
export type Foo = number;
}
export { Enum };
// @Filename: index.ts
import { Enum } from "./merge";
Enum.One;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importEmptyFromModuleNotExisted.ts | TypeScript | import {} from 'module-not-existed'
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importEquals2.ts | TypeScript | // @esModuleInterop: true
// @Filename: /a.ts
class A {}
export type { A }
// @Filename: /b.ts
import * as a from './a';
export = a;
// @Filename: /c.ts
import a = require('./b');
new a.A(); // Error
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importEqualsDeclaration.ts | TypeScript | // @noTypesAndSymbols: true
// @declaration: true
// @Filename: /a.ts
class A { a!: string }
export = A;
// @Filename: /b.ts
class SomeClass {}
export = SomeClass;
// @Filename: /c.ts
import type A = require('./a'); // Ok
import type = require('./b'); // Ok
A.prototype; // Error
const a: A = { a: 'a' }; // Ok
voi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importFromDot.ts | TypeScript | // @module: commonjs
// @Filename: a.ts
export const rootA = 0;
// @Filename: a/index.ts
export const indexInA = 0;
// @Filename: a/b.ts
import { indexInA, rootA } from ".";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importImportOnlyModule.ts | TypeScript | // @module: amd
// @Filename: foo_0.ts
export class C1 {
m1 = 42;
static s1 = true;
}
// @Filename: foo_1.ts
import c1 = require('./foo_0'); // Makes this an external module
var answer = 42; // No exports
// @Filename: foo_2.ts
import foo = require("./foo_1");
var x = foo; // Cause a runtime dependency
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importNonExternalModule.ts | TypeScript | // @module: amd
// @Filename: foo_0.ts
module foo {
export var answer = 42;
}
// @Filename: foo_1.ts
import foo = require("./foo_0");
// Import should fail. foo_0 not an external module
if(foo.answer === 42){
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importSpecifiers_js.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: ./a.ts
export interface A {}
// @Filename: ./a.js
import { type A } from "./a";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importStatements.ts | TypeScript | module A {
export class Point {
constructor(public x: number, public y: number) { }
}
export var Origin = new Point(0, 0);
}
// no code gen expected
module B {
import a = A; //Error generates 'var <Alias> = <EntityName>;'
}
// no code gen expected
module C {
import a = A; //Error generate... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importStatementsInterfaces.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
}
export module inA {
export interface Point3D extends Point {
z: number;
}
}
}
// no code gen expected
module B {
import a = A;
}
// no code gen expected
module C {
import a = A;
import ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag1.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface Foo {
a: number;
}
// @filename: /foo.js
/**
* @import { Foo } from "./types"
*/
/**
* @param { Foo } foo
*/
function f(foo) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag10.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /foo.js
/**
* @import
*/
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag11.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /foo.js
/**
* @import foo
*/
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag12.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /foo.js
/**
* @import foo from
*/
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag13.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface Foo {
a: number;
}
// @filename: /foo.js
/** @import x = require("types") */
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag14.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /foo.js
/** @import * as f from "./foo" with */
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag15.ts | TypeScript | // @declaration: true
// @emitDeclarationOnly: true
// @module: esnext,es2015
// @checkJs: true
// @allowJs: true
// @filename: 0.ts
export interface I { }
// @filename: 1.js
/** @import { I } from './0' with { type: "json" } */
/** @import * as foo from './0' with { type: "json" } */
/** @param {I} a */
function f(... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag16.ts | TypeScript | // @declaration: true
// @emitDeclarationOnly: true
// @checkJs: true
// @allowJs: true
// @filename: a.ts
export default interface Foo {}
export interface I {}
// @filename: b.js
/** @import Foo, { I } from "./a" */
/**
* @param {Foo} a
* @param {I} b
*/
export function foo(a, b) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag2.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface Foo {
a: number;
}
// @filename: /foo.js
/**
* @import * as types from "./types"
*/
/**
* @param { types.Foo } foo
*/
export function f(foo) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag3.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export default interface Foo {
a: number;
}
// @filename: /foo.js
/**
* @import Foo from "./types"
*/
/**
* @param { Foo } foo
*/
export function f(foo) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag4.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface Foo {
a: number;
}
// @filename: /foo.js
/**
* @import { Foo } from "./types"
*/
/**
* @import { Foo } from "./types"
*/
/**
* @param { Foo } foo
*/
function f(foo) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag5.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @declaration: true
// @emitDeclarationOnly: true
// @filename: /types.ts
export interface Foo {
a: number;
}
// @filename: /foo.js
/**
* @import { Foo } from "./types"
*/
/**
* @param { Foo } foo
*/
function f(foo) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag6.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface A {
a: number;
}
export interface B {
a: number;
}
// @filename: /foo.js
/**
* @import {
* A,
* B,
* } from "./types"
*/
/**
* @param { A } a
* @param { B } b
*/
function f(a, b) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag7.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface A {
a: number;
}
export interface B {
a: number;
}
// @filename: /foo.js
/**
* @import {
* A,
* B } from "./types"
*/
/**
* @param { A } a
* @param { B } b
*/
function f(a, b) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag8.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface A {
a: number;
}
export interface B {
a: number;
}
// @filename: /foo.js
/**
* @import
* { A, B }
* from "./types"
*/
/**
* @param { A } a
* @param { B } b
*/
function f(a, b) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTag9.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @noEmit: true
// @filename: /types.ts
export interface A {
a: number;
}
export interface B {
a: number;
}
// @filename: /foo.js
/**
* @import
* * as types
* from "./types"
*/
/**
* @param { types.A } a
* @param { types.B } b
*/
function f(a, b) {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTsBeforeDTs.ts | TypeScript | // @module: commonjs
// @Filename: foo_0.d.ts
export var x: number = 42;
// @Filename: foo_0.ts
export var y: number = 42;
// @Filename: foo_1.ts
import foo = require("./foo_0");
var z1 = foo.x + 10; // Should error, as .ts preferred over .d.ts
var z2 = foo.y + 10; // Should resolve
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeAmbient.ts | TypeScript | // @declaration: true
// @lib: es6
declare module "foo" {
interface Point {
x: number;
y: number;
}
export = Point;
}
const x: import("foo") = { x: 0, y: 0 };
declare module "foo2" {
namespace Bar {
interface I {
a: string;
b: number;
}
}
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeAmbientMissing.ts | TypeScript | // @declaration: true
// @lib: es6
declare module "foo" {
interface Point {
x: number;
y: number;
}
export = Point;
}
const x: import("fo") = { x: 0, y: 0 }; // typo, error
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeAmdBundleRewrite.ts | TypeScript | // @declaration: true
// @module: amd
// @outFile: bundle.js
// @filename: a/b/c.ts
export interface Foo {
x: 12;
}
// @filename: a/inner.ts
const c: import("./b/c").Foo = {x: 12};
export {c};
// @filename: index.ts
const d: typeof import("./a/inner")["c"] = {x: 12};
export {d};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeGenericTypes.ts | TypeScript | // @declaration: true
// @lib: es6
// @filename: foo.ts
interface Point<T> {
x: number;
y: number;
data: T;
}
export = Point;
// @filename: foo2.ts
namespace Bar {
export interface I<T> {
a: string;
b: number;
data: T;
}
}
export namespace Baz {
export interface J<T> {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeInJSDoc.ts | TypeScript | // @target: es6
// @outDir: ./out
// @allowJs: true
// @checkJs: true
// @filename: externs.d.ts
declare namespace MyClass {
export interface Bar {
doer: (x: string) => void;
}
}
declare class MyClass {
field: string;
static Bar: (x: string, y?: number) => void;
constructor(x: MyClass.Bar);
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeLocal.ts | TypeScript | // @declaration: true
// @lib: es6
// @filename: foo.ts
interface Point {
x: number;
y: number;
}
export = Point;
// @filename: foo2.ts
namespace Bar {
export interface I {
a: string;
b: number;
}
}
export namespace Baz {
export interface J {
a: number;
b: string;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importTypeLocalMissing.ts | TypeScript | // @declaration: true
// @lib: es6
// @filename: foo.ts
interface Point {
x: number;
y: number;
}
export = Point;
// @filename: foo2.ts
namespace Bar {
export interface I {
a: string;
b: number;
}
}
export namespace Baz {
export interface J {
a: number;
b: string;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importingExportingTypes.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: /node_modules/@types/node/index.d.ts
declare module "fs" {
export interface WriteFileOptions {}
export function writeFile(path: string, data: any, options: WriteFileOptions, callback: (err: Error) => void): void;
}
// @Filename: /index.js
import {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importsImplicitlyReadonly.ts | TypeScript | // @module: commonjs
// @filename: a.ts
export var x = 1;
var y = 1;
export { y };
// @filename: b.ts
import { x, y } from "./a";
import * as a1 from "./a";
import a2 = require("./a");
const a3 = a1;
x = 1; // Error
y = 1; // Error
a1.x = 1; // Error
a1.y = 1; // Error
a2.x = 1;
a2.y = 1;
a3.x = 1;
a3.y = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/importsNotUsedAsValues_error.ts | TypeScript | // @importsNotUsedAsValues: error
// @noUnusedLocals: true
// @Filename: /a.ts
export default class {}
export class A {}
export type B = {};
export const enum C { One, Two }
// @Filename: /b.ts
import { A, B } from './a'; // Error
let a: A;
let b: B;
console.log(a, b);
// @Filename: /c.ts
import Default, * as named ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/inOperatorWithValidOperands.ts | TypeScript | var x: any;
// valid left operands
// the left operand is required to be of type Any, the String primitive type, or the Number primitive type
var a1: string;
var a2: number;
var a3: string | number | symbol;
var a4: any;
var ra1 = x in x;
var ra2 = a1 in x;
var ra3 = a2 in x;
var ra4 = '' in x;
var ra5 = 0 in x;
var ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithAnyOtherType.ts | TypeScript | // ++ operator on any type
var ANY: any;
var ANY1: any;
var ANY2: any[] = ["", ""];
var obj = {x:1,y:null};
class A {
public a: any;
}
module M {
export var n: any;
}
var objA = new A();
// any type var
var ResultIsNumber1 = ++ANY;
var ResultIsNumber2 = ++ANY1;
var ResultIsNumber3 = ANY1++;
var ResultIsNumbe... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithEnumType.ts | TypeScript | // ++ operator on enum type
enum ENUM1 { A, B, "" };
// expression
var ResultIsNumber1 = ++ENUM1["B"];
var ResultIsNumber2 = ENUM1.B++;
// miss assignment operator
++ENUM1["B"];
ENUM1.B++; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithEnumTypeInvalidOperations.ts | TypeScript | // ++ operator on enum type
enum ENUM { };
enum ENUM1 { A, B, "" };
// enum type var
var ResultIsNumber1 = ++ENUM;
var ResultIsNumber2 = ++ENUM1;
var ResultIsNumber3 = ENUM++;
var ResultIsNumber4 = ENUM1++;
// enum type expressions
var ResultIsNumber5 = ++(ENUM[1] + ENUM[2]);
var ResultIsNumber6 = (ENUM[1] + ENUM[2... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithNumberType.ts | TypeScript | // ++ operator on number type
var NUMBER: number;
var NUMBER1: number[] = [1, 2];
class A {
public a: number;
}
module M {
export var n: number;
}
var objA = new A();
// number type var
var ResultIsNumber1 = ++NUMBER;
var ResultIsNumber2 = NUMBER++;
// expressions
var ResultIsNumber3 = ++objA.a;
var Result... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithNumberTypeInvalidOperations.ts | TypeScript | // ++ operator on number type
var NUMBER: number;
var NUMBER1: number[] = [1, 2];
function foo(): number { return 1; }
class A {
public a: number;
static foo() { return 1; }
}
module M {
export var n: number;
}
var objA = new A();
//number type var
var ResultIsNumber1 = ++NUMBER1;
var ResultIsNumber2 = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithUnsupportedBooleanType.ts | TypeScript | // ++ operator on boolean type
var BOOLEAN: boolean;
function foo(): boolean { return true; }
class A {
public a: boolean;
static foo() { return true; }
}
module M {
export var n: boolean;
}
var objA = new A();
// boolean type var
var ResultIsNumber1 = ++BOOLEAN;
var ResultIsNumber2 = BOOLEAN++;
// bo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/incrementOperatorWithUnsupportedStringType.ts | TypeScript | // ++ operator on string type
var STRING: string;
var STRING1: string[] = ["", ""];
function foo(): string { return ""; }
class A {
public a: string;
static foo() { return ""; }
}
module M {
export var n: string;
}
var objA = new A();
// string type var
var ResultIsNumber1 = ++STRING;
var ResultIsNumber... | 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.