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') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
| 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') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
| 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') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
| 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> = import("./defaultPath");
let p2 = import("./defaultPath") as Promise<typeof anotherModule>;
let p3: Promise<any> = import("./defaultPath");
| 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(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
function returnDynamicLoad(path: string) {
return import(path);
} | 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> = import("./0");
export var p2: Promise<any> = import("./0");
| 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() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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 loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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 loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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 loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
} | 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();
})
}
foo(import("./0")); | 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 myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
} | 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");
return j.backup();
}
return j.foo();
}
compute(import("./0")); | 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();
})
}
foo(import("./0")); | 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 myModule = import("./0");
method() {
const loadAsync = import ("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
} | 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();
})
}
foo(import("./0")); | 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 myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
} | 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();
})
}
foo(import("./0")); | 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 myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
} | 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 loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
} | 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 directory: string;
declare const moduleFile: number;
import(`${directory}\\${moduleFile}`);
import(getSpecifier());
var p1 = import(ValidSomeCondition() ? "./0" : "externalModule");
var p1: Promise<any> = import(getSpecifier());
var p11: Promise<typeof defaultModule> = import(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule>;
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
let j: string;
var p3: Promise<typeof defaultModule> = import(j=getSpecifier());
function * loadModule(directories: string[]) {
for (const directory of directories) {
const path = `${directory}\\moduleFile`;
import(yield path);
}
}
| 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 => {
return zero.foo(); // ok, zero is any
});
var p3 = import(["path1", "path2"]);
var p4 = import(()=>"PathToModule"); | 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
void type; // Ok
export declare const AConstructor: typeof A; // Ok
| 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 generates 'var <Alias> = <EntityName>;'
var m: typeof a;
var p: a.Point;
var p = {x:0, y:0 };
}
// code gen expected
module D {
import a = A;
var p = new a.Point(1, 1);
}
module E {
import a = A;
export function xDist(x: a.Point) {
return (a.Origin.x - x.x);
}
} | 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 b = a.inA;
var m: typeof a;
var p: b.Point3D;
var p = {x:0, y:0, z: 0 };
}
// no code gen expected
module D {
import a = A;
var p : a.Point;
}
// no code gen expected
module E {
import a = A.inA;
export function xDist(x: a.Point3D) {
return 0 - x.x;
}
} | 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(a) {}
| 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;
}
}
namespace Baz {
interface J {
a: number;
b: string;
}
}
class Bar {
item: Bar.I;
constructor(input: Baz.J);
}
}
let y: import("foo2").Bar.I = { a: "", b: 0 };
class Bar2 {
item: {a: string, b: number, c: object};
constructor(input?: any) {}
}
let shim: typeof import("foo2") = {
Bar: Bar2
};
| 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> {
a: number;
b: string;
data: T;
}
}
class Bar<T> {
item: Bar.I<T>;
constructor(input: Baz.J<T>) {}
}
export { Bar }
// @filename: usage.ts
export const x: import("./foo")<{x: number}> = { x: 0, y: 0, data: {x: 12} };
export let y: import("./foo2").Bar.I<{x: number}> = { a: "", b: 0, data: {x: 12} };
export class Bar2<T> {
item: {a: string, b: number, c: object, data: T};
constructor(input?: any) {}
}
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
| 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);
}
declare global {
const Foo: typeof MyClass;
}
export = MyClass;
// @filename: index.js
/**
* @typedef {import("./externs")} Foo
*/
let a = /** @type {Foo} */(/** @type {*} */(undefined));
a = new Foo({doer: Foo.Bar});
const q = /** @type {import("./externs").Bar} */({ doer: q => q });
const r = /** @type {typeof import("./externs").Bar} */(r => r);
| 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;
}
}
class Bar {
item: Bar.I;
constructor(input: Baz.J) {}
}
export { Bar }
// @filename: usage.ts
export const x: import("./foo") = { x: 0, y: 0 };
export let y: import("./foo2").Bar.I = { a: "", b: 0 };
export class Bar2 {
item: {a: string, b: number, c: object};
constructor(input?: any) {}
}
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
| 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;
}
}
class Bar {
item: Bar.I;
constructor(input: Baz.J) {}
}
export { Bar }
// @filename: usage.ts
export const x: import("./fo") = { x: 0, y: 0 };
export let y: import("./fo2").Bar.I = { a: "", b: 0 };
export let z: import("./foo2").Bar.Q = { a: "", b: 0 };
export class Bar2 {
item: {a: string, b: number, c: object};
constructor(input?: any) {}
}
export let shim: typeof import("./fo2") = {
Bar: Bar2
};
| 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 { writeFile, WriteFileOptions, WriteFileOptions as OtherName } from "fs";
/** @typedef {{ x: any }} JSDocType */
export { JSDocType };
export { JSDocType as ThisIsFine };
export { WriteFileOptions };
| 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 = 1; | 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 from './a'; // Error
let a: Default;
let b: named.B;
console.log(a, b);
// @Filename: /d.ts
import Default, { A } from './a';
const a = A;
let b: Default;
console.log(a, b);
// @Filename: /e.ts
import { A, B } from './a'; // noUnusedLocals error only
// @Filename: /f.ts
import { C } from './a';
import type { C as D } from './a';
C.One;
let c: D = C.Two;
let d: D.Two = C.Two;
console.log(c, d);
// @Filename: /g.ts
import { C } from './a';
let c: C;
let d: C.Two;
console.log(c, d);
// @Filename: /h.ts
class H {}
export = H;
// @Filename: /i.ts
import H = require('./h'); // Error
let h: H = {};
console.log(h);
// @Filename: /j.ts
import H = require('./h'); // noUnusedLocals error only
// @Filename: /k.ts
const enum K { One, Two }
export = K;
// @Filename: /l.ts
import K = require('./k');
K.One;
// @Filename: /j.ts
// Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207 | 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 ra6 = a3 in x;
var ra7 = a4 in x;
// valid right operands
// the right operand is required to be of type Any, an object type, or a type parameter type
var b1: {};
var rb1 = x in b1;
var rb2 = x in {};
function foo<T>(t: T) {
var rb3 = x in t;
}
function unionCase<T, U>(t: T | U) {
var rb4 = x in t;
}
function unionCase2<T>(t: T | object) {
var rb5 = x in t;
}
interface X { x: number }
interface Y { y: number }
var c1: X | Y;
var c2: X;
var c3: Y;
var rc1 = x in c1;
var rc2 = x in (c2 || c3);
| 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 ResultIsNumber4 = ANY1++;
// expressions
var ResultIsNumber5 = ++ANY2[0];
var ResultIsNumber6 = ++obj.x;
var ResultIsNumber7 = ++obj.y;
var ResultIsNumber8 = ++objA.a;
var ResultIsNumber = ++M.n;
var ResultIsNumber9 = ANY2[0]++;
var ResultIsNumber10 = obj.x++;
var ResultIsNumber11 = obj.y++;
var ResultIsNumber12 = objA.a++;
var ResultIsNumber13 = M.n++;
// miss assignment opertors
++ANY;
++ANY1;
++ANY2[0];
++ANY, ++ANY1;
++objA.a;
++M.n;
ANY++;
ANY1++;
ANY2[0]++;
ANY++, ANY1++;
objA.a++;
M.n++; | 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])++;
// miss assignment operator
++ENUM;
++ENUM1;
ENUM++;
ENUM1++; | 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 ResultIsNumber4 = ++M.n;
var ResultIsNumber5 = objA.a++;
var ResultIsNumber6 = M.n++;
var ResultIsNumber7 = NUMBER1[0]++;
// miss assignment operators
++NUMBER;
++NUMBER1[0];
++objA.a;
++M.n;
++objA.a, M.n;
NUMBER++;
NUMBER1[0]++;
objA.a++;
M.n++;
objA.a++, M.n++; | 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 = NUMBER1++;
// number type literal
var ResultIsNumber3 = ++1;
var ResultIsNumber4 = ++{ x: 1, y: 2};
var ResultIsNumber5 = ++{ x: 1, y: (n: number) => { return n; } };
var ResultIsNumber6 = 1++;
var ResultIsNumber7 = { x: 1, y: 2 }++;
var ResultIsNumber8 = { x: 1, y: (n: number) => { return n; } }++;
// number type expressions
var ResultIsNumber9 = ++foo();
var ResultIsNumber10 = ++A.foo();
var ResultIsNumber11 = ++(NUMBER + NUMBER);
var ResultIsNumber12 = foo()++;
var ResultIsNumber13 = A.foo()++;
var ResultIsNumber14 = (NUMBER + NUMBER)++;
// miss assignment operator
++1;
++NUMBER1;
++foo();
1++;
NUMBER1++;
foo()++; | 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++;
// boolean type literal
var ResultIsNumber3 = ++true;
var ResultIsNumber4 = ++{ x: true, y: false };
var ResultIsNumber5 = ++{ x: true, y: (n: boolean) => { return n; } };
var ResultIsNumber6 = true++;
var ResultIsNumber7 = { x: true, y: false }++;
var ResultIsNumber8 = { x: true, y: (n: boolean) => { return n; } }++;
// boolean type expressions
var ResultIsNumber9 = ++objA.a;
var ResultIsNumber10 = ++M.n;
var ResultIsNumber11 = ++foo();
var ResultIsNumber12 = ++A.foo();
var ResultIsNumber13 = foo()++;
var ResultIsNumber14 = A.foo()++;
var ResultIsNumber15 = objA.a++;
var ResultIsNumber16 = M.n++;
// miss assignment operators
++true;
++BOOLEAN;
++foo();
++objA.a;
++M.n;
++objA.a, M.n;
true++;
BOOLEAN++;
foo()++;
objA.a++;
M.n++;
objA.a++, M.n++; | 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 ResultIsNumber2 = ++STRING1;
var ResultIsNumber3 = STRING++;
var ResultIsNumber4 = STRING1++;
// string type literal
var ResultIsNumber5 = ++"";
var ResultIsNumber6 = ++{ x: "", y: "" };
var ResultIsNumber7 = ++{ x: "", y: (s: string) => { return s; } };
var ResultIsNumber8 = ""++;
var ResultIsNumber9 = { x: "", y: "" }++;
var ResultIsNumber10 = { x: "", y: (s: string) => { return s; } }++;
// string type expressions
var ResultIsNumber11 = ++objA.a;
var ResultIsNumber12 = ++M.n;
var ResultIsNumber13 = ++STRING1[0];
var ResultIsNumber14 = ++foo();
var ResultIsNumber15 = ++A.foo();
var ResultIsNumber16 = ++(STRING + STRING);
var ResultIsNumber17 = objA.a++;
var ResultIsNumber18 = M.n++;
var ResultIsNumber19 = STRING1[0]++;
var ResultIsNumber20 = foo()++;
var ResultIsNumber21 = A.foo()++;
var ResultIsNumber22 = (STRING + STRING)++;
// miss assignment operators
++"";
++STRING;
++STRING1;
++STRING1[0];
++foo();
++objA.a;
++M.n;
++objA.a, M.n;
""++;
STRING++;
STRING1++;
STRING1[0]++;
foo()++;
objA.a++;
M.n++;
objA.a++, M.n++; | 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.