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/mixinAbstractClasses.ts
TypeScript
// @target: esnext // @declaration: true interface Mixin { mixinMethod(): void; } function Mixin<TBaseClass extends abstract new (...args: any) => any>(baseClass: TBaseClass): TBaseClass & (abstract new (...args: any) => Mixin) { abstract class MixinClass extends baseClass implements Mixin { mixinMeth...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/mixinAbstractClassesReturnTypeInference.ts
TypeScript
// @target: esnext // @declaration: true interface Mixin1 { mixinMethod(): void; } abstract class AbstractBase { abstract abstractBaseMethod(): void; } function Mixin2<TBase extends abstract new (...args: any[]) => any>(baseClass: TBase) { // must be `abstract` because we cannot know *all* of the possibl...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/mixinAccessModifiers.ts
TypeScript
// @declaration: true type Constructable = new (...args: any[]) => object; class Private { constructor (...args: any[]) {} private p: string; } class Private2 { constructor (...args: any[]) {} private p: string; } class Protected { constructor (...args: any[]) {} protected p: string; protected static s: stri...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/mixinClassesAnnotated.ts
TypeScript
// @declaration: true type Constructor<T> = new(...args: any[]) => T; class Base { constructor(public x: number, public y: number) {} } class Derived extends Base { constructor(x: number, y: number, public z: number) { super(x, y); } } interface Printable { print(): void; } const Printable ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/mixinClassesAnonymous.ts
TypeScript
type Constructor<T> = new(...args: any[]) => T; class Base { constructor(public x: number, public y: number) {} } class Derived extends Base { constructor(x: number, y: number, public z: number) { super(x, y); } } const Printable = <T extends Constructor<Base>>(superClass: T) => class extends sup...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/mixinClassesMembers.ts
TypeScript
// @declaration: true declare class C1 { public a: number; protected b: number; private c: number; constructor(s: string); constructor(n: number); } declare class M1 { constructor(...args: any[]); p: number; static p: number; } declare class M2 { constructor(...args: any[]); f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/modifierOnClassDeclarationMemberInFunction.ts
TypeScript
// @declaration: true function f() { class C { public baz = 1; static foo() { } public bar() { } } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/modifierOnClassExpressionMemberInFunction.ts
TypeScript
// @declaration: true // @declaration: true function g() { var x = class C { public prop1 = 1; private foo() { } static prop2 = 43; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAlias.ts
TypeScript
// @allowJS: true // @noEmit: true // @filename: a.ts import b = require("./b.js"); b.func1; b.func2; b.func3; b.func4; b.func5; b.func6; b.func7; b.func8; b.func9; b.func10; b.func11; b.func12; b.func13; b.func14; b.func15; b.func16; b.func17; b.func18; b.func19; b.func20; // @filename: b.js var exportsAlias = expo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAlias2.ts
TypeScript
// @checkJs: true // @allowJS: true // @noEmit: true // @Filename: node.d.ts declare function require(name: string): any; declare var exports: any; declare var module: { exports: any }; // @Filename: semver.js /// <reference path='node.d.ts' /> exports = module.exports = C exports.f = n => n + 1 function C() { this...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAlias3.ts
TypeScript
// @checkJs: true // @allowJS: true // @noEmit: true // @Filename: bug24062.js // #24062 class C { } module.exports = { C };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAlias4.ts
TypeScript
// @checkJs: true // @noEmit: true // @Filename: bug24024.js // #24024 var wat = require('./bug24024') module.exports = class C {} module.exports.D = class D { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAlias5.ts
TypeScript
// @checkJs: true // @allowJS: true // @noEmit: true // @Filename: bug24754.js // #24754 const webpack = function (){ } exports = module.exports = webpack; exports.version = 1001; webpack.WebpackOptionsDefaulter = 1111;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAliasElementAccessExpression.ts
TypeScript
// @declaration: true // @checkJs: true // @filename: moduleExportAliasElementAccessExpression.js // @outdir: out function D () { } exports["D"] = D; // (the only package I could find that uses spaces in identifiers is webidl-conversions) exports["Does not work yet"] = D;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAliasExports.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: Eloquent.js // bug #27365, crashes from github.com/marijnh/Eloquent-JavaScript (function() { exports.bigOak = 1 exports.everywhere = 2 module.exports = exports })()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAliasImported.ts
TypeScript
// @allowJs: true // @noEmit: true // @checkJs: true // @target: esnext // @module: esnext // @Filename: bug28014.js exports.version = 1 function alias() { } module.exports = alias // @Filename: importer.js import('./bug28014')
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAliasUnknown.ts
TypeScript
// @allowJs: true // @noEmit: true // @checkJs: true // @Filename: bug27025.js module.exports = window.nonprop; exports.foo = bar;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: npmlog.js class EE { /** @param {string} s */ on(s) { } } var npmlog = module.exports = new EE() npmlog.on('hi') // both references should see EE.on module.exports.on('hi') // here too npmlog.x = 1 module.exports.y = 2 npmlog.y module.exports....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment2.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: npm.js var npm = module.exports = function (tree) { } module.exports.asReadInstalled = function (tree) { npm(tree) // both references should be callable module.exports(tree) }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment3.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod.js module.exports = function x() { } module.exports() // should be callable // @Filename: npm.js var mod = require('./mod') mod() // should be callable from here too
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment4.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: async.js exports.default = { m: 1, a: 1 } module.exports = exports['default'];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment5.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: axios.js class Axios { constructor() { } m() { } } var axios = new Axios(); // none of the 3 references should have a use-before-def error axios.m() module.exports = axios; module.exports.default = axios;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment6.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: webpackLibNormalModule.js class C { /** @param {number} x */ constructor(x) { this.x = x this.exports = [x] } /** @param {number} y */ m(y) { return this.x + y } } function exec() { const module = new ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportAssignment7.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod.js class Thing { x = 1 } class AnotherThing { y = 2 } function foo() { return 3 } function bar() { return 4 } /** @typedef {() => number} buz */ module.exports = { Thing, AnotherThing, foo, qux: bar, baz() { return 5 }, lit...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportDuplicateAlias.ts
TypeScript
// @checkJs: true // @strict: true // @declaration: true // @outdir: out // @filename: moduleExportAliasDuplicateAlias.js exports.apply = undefined; function a() { } exports.apply() exports.apply = a; exports.apply() // @filename: test.js const { apply } = require('./moduleExportAliasDuplicateAlias') apply()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportDuplicateAlias2.ts
TypeScript
// @checkJs: true // @strict: true // @declaration: true // @outdir: out // @filename: moduleExportAliasDuplicateAlias.js module.exports.apply = undefined; function a() { } module.exports.apply = a; module.exports.apply = a; module.exports.apply() // @filename: test.js const { apply } = require('./moduleExportAliasDup...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportDuplicateAlias3.ts
TypeScript
// @checkJs: true // @strict: true // @declaration: true // @filename: moduleExportAliasDuplicateAlias.js // @outdir: out exports.apply = undefined; exports.apply = undefined; function a() { } exports.apply = a; exports.apply() exports.apply = 'ok' var OK = exports.apply.toUpperCase() exports.apply = 1 // @filename: t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportNestedNamespaces.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: mod.js module.exports.n = {}; module.exports.n.K = function C() { this.x = 10; } module.exports.Classic = class { constructor() { this.p = 1 } } // @Filename: use.js import * as s from './mod' var k = new s.n.K() k.x var classic =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportPropertyAssignmentDefault.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: axios.js var axios = {} module.exports = axios // both assignments should be ok module.exports.default = axios
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportWithExportPropertyAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: requires.d.ts declare var module: { exports: any }; declare function require(name: string): any; // @Filename: mod1.js /// <reference path='./requires.d.ts' /> module.exports = function () { } /** @param {number} a */ module.exports.f = function (a) { }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportWithExportPropertyAssignment2.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: requires.d.ts declare var module: { exports: any }; declare function require(name: string): any; // @Filename: mod1.js /// <reference path='./requires.d.ts' /> module.exports = 1 module.exports.f = function () { } // @Filename: a.js /// <reference path...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportWithExportPropertyAssignment3.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: requires.d.ts declare var module: { exports: any }; declare function require(name: string): any; // @Filename: mod1.js /// <reference path='./requires.d.ts' /> module.exports.bothBefore = 'string' module.exports = { justExport: 1, bothBefore: 2,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportWithExportPropertyAssignment4.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: requires.d.ts declare var module: { exports: any }; declare function require(name: string): any; // @Filename: mod1.js /// <reference path='./requires.d.ts' /> module.exports.bothBefore = 'string' A.justExport = 4 A.bothBefore = 2 A.bothAfter = 3 module...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportsAliasLoop1.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @filename: x.js exports.fn1(); exports.fn2 = Math.min;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportsAliasLoop2.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @filename: x.js const Foo = { min: 3 }; exports.fn1(); exports.fn2 = Foo.min;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportsElementAccessAssignment.ts
TypeScript
// @allowJs: true // @strict: true // @checkJs: true // @emitDeclarationOnly: true // @declaration: true // @filename: mod1.js exports.a = { x: "x" }; exports["b"] = { x: "x" }; exports["default"] = { x: "x" }; module.exports["c"] = { x: "x" }; module["exports"]["d"] = {}; module["exports"]["d"].e = 0; // @filename: m...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleExportsElementAccessAssignment2.ts
TypeScript
// @noEmit: true // @checkJs: true // @allowJs: true // @strict: true // @Filename: file1.js // this file _should_ be a global file var GlobalThing = { x: 12 }; /** * @param {*} type * @param {*} ctor * @param {*} exports */ function f(type, ctor, exports) { if (typeof exports !== "undefined") { expo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithExtensions.ts
TypeScript
// @traceResolution: true // @Filename: /src/a.ts export default 0; // No extension: '.ts' added // @Filename: /src/b.ts import a from './a'; // '.js' extension: stripped and replaced with '.ts' // @Filename: /src/d.ts import a from './a.js'; // @Filename: /src/jquery.d.ts declare var x: number; export default x; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension1.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/foo.mts export function foo() { return ""; } // @filename: /src/bar.mts // Extensionless relative path ES import in an ES module import { foo } from "./foo"; // should error, suggest adding ".mjs" import { baz } from "./baz"; // should error, ask ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension2.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/buzz.mts // Extensionless relative path cjs import in an ES module import foo = require("./foo"); // should error, should not ask for extension
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension3.ts
TypeScript
// @moduleResolution: nodenext // @module: nodenext // @jsx: preserve // @filename: /src/foo.tsx export function foo() { return ""; } // @filename: /src/bar.mts // Extensionless relative path ES import in an ES module import { foo } from "./foo"; // should error, suggest adding ".jsx"
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension4.ts
TypeScript
// @moduleResolution: nodenext // @module: nodenext // @jsx: react // @filename: /src/foo.tsx export function foo() { return ""; } // @filename: /src/bar.mts // Extensionless relative path ES import in an ES module import { foo } from "./foo"; // should error, suggest adding ".js"
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension5.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/buzz.mts // Extensionless relative path dynamic import in an ES module import("./foo").then(x => x); // should error, ask for extension
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension6.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/bar.cts // Extensionless relative path import statement in a cjs module // Import statements are not allowed in cjs files, // but other errors should not assume that they are allowed import { foo } from "./foo"; // should error, should not ask for exte...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension7.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/bar.cts // Extensionless relative path cjs import in a cjs module import foo = require("./foo"); // should error, should not ask for extension
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleResolutionWithoutExtension8.ts
TypeScript
// @moduleResolution: node16 // @module: node16 // @filename: /src/bar.cts // Extensionless relative path dynamic import in a cjs module import("./foo").then(x => x); // should error, ask for extension
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleScoping.ts
TypeScript
// @Filename: file1.ts var v1 = "sausages"; // Global scope // @Filename: file2.ts var v2 = 42; // Global scope var v4 = () => 5; // @Filename: file3.ts export var v3 = true; var v2 = [1,2,3]; // Module scope. Should not appear in global scope // @Filename: file4.ts import file3 = require('./file3'); var t1 = v1; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/moduleWithStatementsOfEveryKind.ts
TypeScript
module A { class A { s: string } class AA<T> { s: T } interface I { id: number } class B extends AA<string> implements I { id: number } class BB<T> extends A { id: number; } module Module { class A { s: string } } enum Color { Blue, Red } var x = 12; functio...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multiline.tsx
TypeScript (TSX)
// @filename: a.ts export const texts: string[] = []; /** @ts-ignore */ texts.push(100); /** @ts-expect-error */ texts.push(100); /** @ts-expect-error */ texts.push("100"); // @filename: b.tsx // @jsx: react // @libFiles: react.d.ts,lib.d.ts import * as React from "react"; export function MyComponent(props: { f...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDeclarations.ts
TypeScript
// @filename: input.js // @outFile: output.js // @allowJs: true function C() { this.m = null; } C.prototype.m = function() { this.nothing(); } class X { constructor() { this.m = this.m.bind(this); this.mistake = 'frankly, complete nonsense'; } m() { } mistake() { } } let ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDefaultExports01.ts
TypeScript
// @module: commonjs // @target: ES5 // @filename: m1.ts export default class foo { } export default function bar() { } var x = 10; export default x; // @filename: m2.ts import Entity from "./m1" Entity();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDefaultExports02.ts
TypeScript
// @module: commonjs // @target: ES5 // @filename: m1.ts export default function foo() { } export default function bar() { } // @filename: m2.ts import Entity from "./m1" Entity();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDefaultExports03.ts
TypeScript
// @module: commonjs // @target: ES5 export default class C { } export default class C { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDefaultExports04.ts
TypeScript
// @module: commonjs // @target: ES5 export default function f() { } export default function f() { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleDefaultExports05.ts
TypeScript
// @module: commonjs // @target: ES5 export default class AA1 {} export default class BB1 {} export default class CC1 {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault1.ts
TypeScript
export default function Foo (){ } export default { uhoh: "another default", };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault2.ts
TypeScript
export default { uhoh: "another default", }; export default function Foo() { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault3.ts
TypeScript
export default { uhoh: "another default", }; export default class C { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault4.ts
TypeScript
export default class C { } export default { uhoh: "another default", };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault5.ts
TypeScript
export default function bar() { } export default class C {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleExportDefault6.ts
TypeScript
export default { lol: 1 } export default { lol: 2 }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleNumericIndexers.ts
TypeScript
// Multiple indexers of the same type are an error class C { [x: number]: string; [x: number]: string; } interface I { [x: number]: string; [x: number]: string; } var a: { [x: number]: string; [x: number]: string; } var b: { [x: number]: string; [x: number]: string } = { 1: '', "2": ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/multipleStringIndexers.ts
TypeScript
// Multiple indexers of the same type are an error class C { [x: string]: string; [x: string]: string; } interface I { [x: string]: string; [x: string]: string; } var a: { [x: string]: string; [x: string]: string; } var b: { [x: string]: string; [x: string]: string; } = { y: '' } cl...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nameCollision.ts
TypeScript
module A { // these 2 statements force an underscore before the 'A' // in the generated function call. var A = 12; var _A = ''; } module B { var A = 12; } module B { // re-opened module with colliding name // this should add an underscore. class B { name: string; } } modu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nameDelimitedBySlashes.ts
TypeScript
// @module: commonjs // @Filename: test/foo_0.ts export var foo = 42; // @Filename: foo_1.ts import foo = require('./test/foo_0'); var x = foo.foo + 42;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nameWithFileExtension.ts
TypeScript
// @module: commonjs // @Filename: foo_0.ts export var foo = 42; // @Filename: foo_1.ts import foo = require('./foo_0.js'); var x = foo.foo + 42;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nameWithRelativePaths.ts
TypeScript
// @module: commonjs // @Filename: foo_0.ts export var foo = 42; // @Filename: test/test/foo_1.ts export function f(){ return 42; } // @Filename: test/foo_2.ts export module M2 { export var x = true; } // @Filename: test/foo_3.ts import foo0 = require('../foo_0'); import foo1 = require('./test/foo_1'); import foo2...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namedTupleMembers.ts
TypeScript
// @declaration: true export type Segment = [length: number, count: number]; export type SegmentAnnotated = [ /** * Size of message buffer segment handles */ length: number, /** * Number of segments handled at once */ count: number ]; declare var a: Segment; declare var b: Segmen...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceAssignmentToRequireAlias.ts
TypeScript
// @allowJs: true // @checkJs: true // @strict: true // @outDir: out // @declaration: true // @filename: node_modules/untyped/index.js module.exports = {} // @filename: bug40140.js const u = require('untyped'); u.assignment.nested = true u.noError()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceImportTypeQuery.ts
TypeScript
// @Filename: /a.ts class A {} export type { A }; export class B {}; // @Filename: /b.ts import * as types from './a'; let A: typeof types.A; let B: typeof types.B; let t: typeof types = { // error: while you can ask for `typeof types.A`, // `typeof types` does not include `A` A: undefined as any, B: undefine...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceImportTypeQuery2.ts
TypeScript
// @Filename: /z.ts interface A {} export type { A }; // @Filename: /a.ts import { A } from './z'; const A = 0; export { A }; export class B {}; // @Filename: /b.ts import * as types from './a'; let t: typeof types = { A: undefined as any, // ok B: undefined as any, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceImportTypeQuery3.ts
TypeScript
// @Filename: /a.ts import type { A } from './z'; // unresolved const A = 0; export { A }; export class B {}; // @Filename: /b.ts import * as types from './a'; let t: typeof types = { A: undefined as any, // ok B: undefined as any, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceImportTypeQuery4.ts
TypeScript
// @Filename: /a.ts import type { A } from './z'; // unresolved type A = 0; export { A }; export class B {}; // @Filename: /b.ts import * as types from './a'; let t: typeof types = { A: undefined as any, // error B: undefined as any, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/namespaceMemberAccess.ts
TypeScript
// @Filename: /a.ts class A { a!: string } export type { A }; // @Filename: /b.ts import * as types from './a'; types.A; const { A } = types;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/narrowExceptionVariableInCatchClause.ts
TypeScript
declare function isFooError(x: any): x is { type: 'foo'; dontPanic(); }; function tryCatch() { try { // do stuff... } catch (err) { // err is implicitly 'any' and cannot be annotated if (isFooError(err)) { err.dontPanic(); // OK err.doPanic(); // ERROR: Property 'do...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/narrowFromAnyWithInstanceof.ts
TypeScript
declare var x: any; if (x instanceof Function) { // 'any' is not narrowed when target type is 'Function' x(); x(1, 2, 3); x("hello!"); x.prop; } if (x instanceof Object) { // 'any' is not narrowed when target type is 'Object' x.method(); x(); } if (x instanceof Error) { // 'any' is narrowed t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/narrowFromAnyWithTypePredicate.ts
TypeScript
declare var x: any; declare function isFunction(x): x is Function; declare function isObject(x): x is Object; declare function isAnything(x): x is {}; declare function isError(x): x is Error; declare function isDate(x): x is Date; if (isFunction(x)) { // 'any' is not narrowed when target type is 'Function' x(); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/narrowingConstrainedTypeVariable.ts
TypeScript
// @strict: true // Repro from #20138 class C { } function f1<T extends C>(v: T | string): void { if (v instanceof C) { const x: T = v; } else { const s: string = v; } } class D { } function f2<T extends C, U extends D>(v: T | U) { if (v instanceof C) { const x: T = v; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/narrowingGenericTypeFromInstanceof01.ts
TypeScript
class A<T> { constructor(private a: string) { } } class B<T> { } function acceptA<T>(a: A<T>) { } function acceptB<T>(b: B<T>) { } function test<T>(x: A<T> | B<T>) { if (x instanceof B) { acceptA(x); } if (x instanceof A) { acceptA(x); } if (x instanceof B) { acceptB...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/negateOperatorWithBooleanType.ts
TypeScript
// - operator on boolean type var BOOLEAN: boolean; function foo(): boolean { return true; } class A { public a: boolean; static foo() { return false; } } module M { export var n: boolean; } var objA = new A(); // boolean type var var ResultIsNumber1 = -BOOLEAN; // boolean type literal var ResultIsNumb...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/negateOperatorWithEnumType.ts
TypeScript
// - operator on enum type enum ENUM { }; enum ENUM1 { A, B, "" }; // enum type var var ResultIsNumber1 = -ENUM; // expressions var ResultIsNumber2 = -ENUM1["B"]; var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]); // miss assignment operators -ENUM; -ENUM1; -ENUM1["B"]; -ENUM, ENUM1;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/negateOperatorWithNumberType.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 = -NUMBER; var ResultIsNumber2 = -N...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/negateOperatorWithStringType.ts
TypeScript
// - operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; function foo(): string { return "abc"; } class A { public a: string; static foo() { return ""; } } module M { export var n: string; } var objA = new A(); // string type var var ResultIsNumber1 = -STRING; var ResultIsNu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nestedDestructuringOfRequire.ts
TypeScript
// @allowJs: true // @checkJs: true // @outDir: out // @declaration: true // @filename: mod1.js const chalk = { grey: {} }; module.exports.chalk = chalk // @filename: main.js const { chalk: { grey } } = require('./mod1'); grey chalk
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nestedModules.ts
TypeScript
module A.B.C { export interface Point { x: number; y: number; } } module A { export module B { var Point: C.Point = { x: 0, y: 0 }; // bug 832088: could not find module 'C' } } module M2.X { export interface Point { x: number; y: number; } } module M2 { exp...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nestedNamespace.ts
TypeScript
// @Filename: a.ts export namespace types { export class A {} } // @Filename: b.ts import type * as a from './a'; interface B extends a.types.A {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/nestedPrototypeAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @noImplicitAny: true // @Filename: mod.js // #24111 -- shouldn't assert C.prototype = {} C.prototype.bar.foo = {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverInference.ts
TypeScript
// @lib: es2015 // @strict: true // @target: es2015 declare function f1<T>(x: T[]): T; let neverArray: never[] = []; let a1 = f1([]); // never let a2 = f1(neverArray); // never // Repro from #19576 type Comparator<T> = (x: T, y: T) => number; interface LinkedList<T> { comparator: Comparator<T>, nodes: N...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverIntersectionNotCallable.ts
TypeScript
declare const f: { (x: string): number, a: "" } & { a: number } f()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverReturningFunctions1.ts
TypeScript
// @strict: true // @allowUnreachableCode: false // @declaration: true function fail(message?: string): never { throw new Error(message); } function f01(x: string | undefined) { if (x === undefined) fail("undefined argument"); x.length; // string } function f02(x: number): number { if (x >= 0) retur...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverType.ts
TypeScript
// @strictNullChecks: true // @declaration: true function error(message: string): never { throw new Error(message); } function errorVoid(message: string) { throw new Error(message); } function fail() { return error("Something failed"); } function failOrThrow(shouldFail: boolean) { if (shouldFail) {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverTypeErrors1.ts
TypeScript
function f1() { let x: never; x = 1; x = "abc"; x = false; x = undefined; x = null; x = {}; x(); } function f2(): never { return; } function f3(): never { return 1; } function f4(): never { } for (const n of f4()) {} for (const n in f4()) {} function f5() { let x: never[...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverTypeErrors2.ts
TypeScript
// @strictNullChecks: true function f1() { let x: never; x = 1; x = "abc"; x = false; x = undefined; x = null; x = {}; x(); } function f2(): never { return; } function f3(): never { return 1; } function f4(): never { } for (const n of f4()) {} for (const n in f4()) {} funct...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/neverUnionIntersection.ts
TypeScript
// @strict: true type T01 = string | never; type T02 = string & never; type T03 = string | number | never; type T04 = string & number & never; type T05 = any | never; type T06 = any & never; type T07 = undefined | never; type T08 = undefined & never; type T09 = null | never; type T10 = null & never; type T11 = { a: st...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newOperatorConformance.ts
TypeScript
class C0 { } class C1 { constructor(n: number, s: string) { } } class T<T> { constructor(n?: T) { } } var anyCtor: { new (): any; }; var anyCtor1: { new (n): any; }; interface nestedCtor { new (): nestedCtor; } var nestedCtor: nestedCtor; // Construct expression with no parentheses for constr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newOperatorErrorCases_noImplicitAny.ts
TypeScript
// @noImplicitAny: true function fnNumber(this: void): number { return 90; } new fnNumber(); // Error function fnVoid(this: void): void {} new fnVoid(); // Error function functionVoidNoThis(): void {} new functionVoidNoThis(); // Error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newTarget.es5.ts
TypeScript
// @target: es5 class A { constructor() { const a = new.target; const b = () => new.target; } static c = function () { return new.target; } d = function () { return new.target; } } class B extends A { constructor() { super(); const e = new.target; const f = (...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newTarget.es6.ts
TypeScript
// @target: es6 class A { constructor() { const a = new.target; const b = () => new.target; } static c = function () { return new.target; } d = function () { return new.target; } } class B extends A { constructor() { super(); const e = new.target; const f = (...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newTargetNarrowing.ts
TypeScript
// @target: es6 // @strict: true function foo(x: true) { } function f() { if (new.target.marked === true) { foo(new.target.marked); } } f.marked = true;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/newWithSpread.ts
TypeScript
function f(x: number, y: number, ...z: string[]) { } function f2(...x: string[]) { } interface A { f: { new (x: number, y: number, ...z: string[]); } } class B { constructor(x: number, y: number, ...z: string[]) {} } interface C { "a-b": typeof B; } interface D { 1: typeof B; } var a:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University