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/overloadTag3.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @strict: true
// @noEmit: true
// @filename: /a.js
/**
* @template T
*/
export class Foo {
/**
* @constructor
* @overload
*/
constructor() { }
/**
* @param {T} value
*/
bar(value) { }
}
/** @type {Foo<number>} */
let foo;
foo = new Foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override1.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
class B {
foo (v: string) {}
fooo (v: string) {}
}
class D extends B {
override foo (v: string) {}
fooo (v: string) {}
override bar(v: string) {}
}
class C {
override foo(v: string) {}
}
function f () {
return class extends B {
override foo (v: string) {}
fooo (v: string) {}
override bar(v: string) {}
}
}
class E extends (class {
foo () { }
bar () { }
}) {
override foo () { }
bar () { }
baz() {}
override bazz () {}
}
function ff () {
return class {
override foo () {}
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override10.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
abstract class Base {
abstract foo(): unknown;
abstract bar(): void;
}
abstract class Sub extends Base {
abstract override foo(): number;
bar() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override12.ts | TypeScript | // @noImplicitOverride: true
// @target: es2015,esnext
class A {
public m1(): number {
return 0;
}
public m2(): number {
return 0;
}
public m3(): void {}
}
class B extends A {
override m1() {
return 10;
}
override m2(): number {
return 30;
}
override m3(): void {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override13.ts | TypeScript | // @noImplicitOverride: true
// @target: esnext
class Foo {
property = 1
static staticProperty = 2
}
class SubFoo extends Foo {
property = 42;
staticProperty = 42;
}
class StaticSubFoo extends Foo {
static property = 42;
static staticProperty = 42;
}
class Intermediate extends Foo {}
class Derived extends Intermediate {
property = 42;
staticProperty = 42;
}
class StaticDerived extends Intermediate {
static property = 42;
static staticProperty = 42;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override14.ts | TypeScript | // @noImplicitOverride: true
// @target: esnext
class Foo {
property = 1
}
class SubFoo extends Foo {
declare property: number
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override15.ts | TypeScript | // @noImplicitOverride: true
class A {
doSomething() {}
}
class B extends A {
override doSomethang() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override16.ts | TypeScript | // @target: esnext,es2015
// @noImplicitOverride: true
class A {
foo?: string;
}
class B extends A {
override foo = "string";
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override17.ts | TypeScript | // @noImplicitOverride: true
// @useDefineForClassFields: true
// @target: es2015,esnext
class A {
public m1(): number {
return 0;
}
public m2(): number {
return 0;
}
public m3(): void {}
}
class B extends A {
override m1() {
return 10;
}
override m2(): number {
return 30;
}
override m3(): void {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override18.ts | TypeScript | // @target: esnext,es2015
// @noImplicitOverride: true
// @useDefineForClassFields: true
class A {
foo?: string;
}
class B extends A {
override foo = "string";
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override19.ts | TypeScript | // @target: esnext
// @noImplicitOverride: true
type Foo = abstract new(...args: any) => any;
declare function CreateMixin<C extends Foo, T extends Foo>(Context: C, Base: T): T & {
new (...args: any[]): { context: InstanceType<C> }
}
class Context {}
class A {
doSomething() {}
}
class B extends CreateMixin(Context, A) {
override foo() {} // Remove override
}
class C extends CreateMixin(Context, A) {
override doSomethang() {} // Suggestion 'doSomething'
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override2.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
abstract class AB {
abstract foo(v: string): void;
abstract bar(v: string): void;
abstract baz(v: string): void;
}
abstract class AD1 extends AB {
}
abstract class AD2 extends AB {
abstract foo(v: ''): void // need override?
}
abstract class AD3 extends AB {
override foo(v: ''): void { } // need override?
abstract bar(): void;
baz(): void { }
}
class D4 extends AB {
override foo(v: ''): void {}
override bar(v: ''): void {}
baz(): void { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override20.ts | TypeScript | // @target: esnext
// @noImplicitOverride: true
const Foo: C1 & C2 =
class {
m1() { }
m2() { }
}
interface I1 {
m1(): void;
}
interface I2 {
m1(): void;
m2(): void;
}
interface C1 {
new(...args: any[]): I1;
}
interface C2 {
new(...args: any[]): I2;
}
export class Bar extends Foo {
m1() {
super.m1();
}
m2() {
super.m2();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override3.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
declare class B {
foo(): void
bar(): void
}
declare class D extends B {
foo (): void;
override bar (): void;
}
class DB extends B {
override foo(): void {}
override bar(): void {}
}
class DD extends D {
override foo(): void {}
override bar(): void {}
}
class EB extends D {
foo(): void {}
override bar(): void {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override4.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
class B {
p1: number = 1;
p2: number = 1;
p3: () => void;
p4: () => void;
foo (v: string) {}
fooo (v: string) {}
}
class D extends B {
p1: number = 2;
override p2: number = 3;
p3: () => void;
override p4: () => void;
override foo (v: string) {}
fooo (v: string) {}
}
class DD extends B {
override foo: () => void
fooo: () => void;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override6.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
class B {
public baz: number = 1;
constructor(public foo: string, public bar: number) {
}
}
class D extends B {
public bar: number = 1
constructor(public foo: string, public baz: number) {
super(foo, 42)
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override8.ts | TypeScript | // @declaration: true
// @noImplicitOverride: true
class B {
a: string
}
class D extends B {
constructor(public a: string, public b: string) {
super();
}
}
class BB {
constructor(public a: string) {
}
}
class DD extends BB {
constructor(public a: string) {
super(a)
}
}
class DDD extends BB {
public a: string;
constructor(a: string) {
super(a)
this.a = a
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/overrideInterfaceProperty.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: false
interface Mup<K, V> {
readonly size: number;
}
interface MupConstructor {
new(): Mup<any, any>;
new<K, V>(entries?: readonly (readonly [K, V])[] | null): Mup<K, V>;
readonly prototype: Mup<any, any>;
}
declare var Mup: MupConstructor;
class Sizz extends Mup {
// ok, because Mup is an interface
get size() { return 0 }
}
class Kasizz extends Mup {
size = -1
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/overrideWithoutNoImplicitOverride1.ts | TypeScript | // @noImplicitOverride: false
export declare class AmbientClass {
override yadda(): void;
}
export class NonAmbientClass {
override yadda(): void {}
}
/////
export declare class AmbientBase {
foo(): void;
}
export declare class AmbientDerived extends AmbientBase {
foo(): void;
override bar(): void;
}
/////
declare namespace ambientNamespace {
export class AmbientBase {
foo(): void;
}
export class AmbientDerived extends AmbientBase {
foo(): void;
override bar(): void;
}
}
/////
export class NonAmbientBase {
foo(): void {}
}
export class NonAmbientDerived extends NonAmbientBase {
foo(): void {}
override bar(): void {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override_js1.ts | TypeScript | // @noImplicitOverride: true
// @allowJs: true
// @noEmit: true
// @Filename: a.js
class B {
foo (v) {}
fooo (v) {}
}
class D extends B {
foo (v) {}
/** @override */
fooo (v) {}
/** @override */
bar(v) {}
}
class C {
foo () {}
/** @override */
fooo (v) {}
/** @override */
bar(v) {}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override_js2.ts | TypeScript | // @noImplicitOverride: true
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
class B {
foo (v) {}
fooo (v) {}
}
class D extends B {
foo (v) {}
/** @override */
fooo (v) {}
/** @override */
bar(v) {}
}
class C {
foo () {}
/** @override */
fooo (v) {}
/** @override */
bar(v) {}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override_js3.ts | TypeScript | // @noImplicitOverride: true
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
class B {
foo (v) {}
fooo (v) {}
}
class D extends B {
override foo (v) {}
/** @override */
fooo (v) {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/override_js4.ts | TypeScript | // @noImplicitOverride: true
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: a.js
class A {
doSomething() {}
}
class B extends A {
/** @override */
doSomethang() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/packageJsonImportsExportsOptionCompat.ts | TypeScript | // @moduleResolution: classic, node, node16, nodenext, bundler
// @resolvePackageJsonImports: true
// @resolvePackageJsonExports: true
// @noTypesAndSymbols: true
// @noEmit: true
// @Filename: index.ts | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagBracketsAddOptionalUndefined.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js
/**
* @param {number} [p]
* @param {number=} q
* @param {number} [r=101]
*/
function f(p, q, r) {
p = undefined
q = undefined
// note that, unlike TS, JSDOC [r=101] retains | undefined because
// there's no code emitted to get rid of it.
r = undefined
}
f()
f(undefined, undefined, undefined)
f(1, 2, 3)
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagNestedWithoutTopLevelObject.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: paramTagNestedWithoutTopLevelObject.js
/**
* @param {number} xyz.p
*/
function g(xyz) {
return xyz.p;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagNestedWithoutTopLevelObject2.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: paramTagNestedWithoutTopLevelObject2.js
/**
* @param {object} xyz.bar
* @param {number} xyz.bar.p
*/
function g(xyz) {
return xyz.bar.p;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagNestedWithoutTopLevelObject3.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: paramTagNestedWithoutTopLevelObject3.js
/**
* @param {object} xyz
* @param {number} xyz.bar.p
*/
function g(xyz) {
return xyz.bar.p;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagNestedWithoutTopLevelObject4.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: paramTagNestedWithoutTopLevelObject4.js
/**
* @param {number} xyz.bar.p
*/
function g(xyz) {
return xyz.bar.p;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagOnCallExpression.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: decls.d.ts
declare function factory(type: string): {};
// @Filename: a.js
// from util
/** @param {function} ctor - A big long explanation follows */
exports.inherits = factory('inherits')
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagOnFunctionUsingArguments.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: decls.d.ts
declare function factory(type: string): {};
// @Filename: a.js
/**
* @param {string} first
*/
function concat(/* first, second, ... */) {
var s = ''
for (var i = 0, l = arguments.length; i < l; i++) {
s += arguments[i]
}
return s
}
/**
* @param {...string} strings
*/
function correct() {
arguments
}
correct(1,2,3) // oh no
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagTypeResolution.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: first.js
/** @template T
* @param {T} x
* @param {(t: T) => void} k
*/
module.exports = function (x, k) { return k(x) }
// @Filename: main.js
var f = require('./first');
f(1, n => { })
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagTypeResolution2.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: 38572.js
/**
* @template T
* @param {T} a
* @param {{[K in keyof T]: (value: T[K]) => void }} b
*/
function f(a, b) {
}
f({ x: 42 }, { x(param) { param.toFixed() } });
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/paramTagWrapping.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: good.js
/**
* @param
* {number} x Arg x.
* @param {number}
* y Arg y.
* @param {number} z
* Arg z.
*/
function good(x, y, z) {
}
good(1, 2, 3)
// @Filename: bad.js
/**
* @param *
* {number} x Arg x.
* @param {number}
* * y Arg y.
* @param {number} * z
* Arg z.
*/
function bad(x, y, z) {
}
bad(1, 2, 3)
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parameterInitializersBackwardReferencing.ts | TypeScript | // @target: es5, es2015, esnext
// @noEmit: true
// @noTypesAndSymbols: true
// https://github.com/microsoft/TypeScript/issues/38243
function test0({ a = 0, b = a } = {}) {
return { a, b };
}
function test1({ c: { a = 0, b = a } = {} } = {}) {
return { a, b };
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parameterInitializersForwardReferencing.2.ts | TypeScript | // @target: es5, es2015, esnext
// @noEmit: true
// @noTypesAndSymbols: true
// https://github.com/microsoft/TypeScript/issues/36295
function a(): any {}
function b({ b = a(), ...x } = a()) {
var a;
}
const x = "";
function c({ b, ...c } = a(), d = x) {
var x;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parameterInitializersForwardReferencing.ts | TypeScript | function left(a, b = a, c = b) {
a;
b;
}
function right(a = b, b = a) {
a;
b;
}
function right2(a = b, b = c, c = a) {
a;
b;
c;
}
function inside(a = b) {
var b;
}
function outside() {
var b;
function inside(a = b) { // Still an error because b is declared inside the function
var b;
}
}
function defaultArgFunction(a = function () { return b; }, b = 1) { }
function defaultArgArrow(a = () => () => b, b = 3) { }
class C {
constructor(a = b, b = 1) { }
method(a = b, b = 1) { }
}
// Function expressions
var x = (a = b, b = c, c = d) => { var d; };
// Should not produce errors - can reference later parameters if they occur within a function expression initializer.
function f(a, b = function () { return c; }, c = b()) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parameterInitializersForwardReferencing1.ts | TypeScript | let foo: string = "";
function f1 (bar = foo) { // unexpected compiler error; works at runtime
var foo: number = 2;
return bar; // returns 1
}
function f2 (bar = (baz = foo) => baz) { // unexpected compiler error; works at runtime
var foo: number = 2;
return bar(); // returns 1
}
function f3 (bar = foo, foo = 2) { // correct compiler error, error at runtime
return bar;
}
function f4 (foo, bar = foo) {
return bar
}
function f5 (a = a) {
return a
}
function f6 (async = async) {
return async
}
function f7({[foo]: bar}: any[]) {
let foo: number = 2;
}
class Foo {
constructor(public x = 12, public y = x) {}
}
function f8(foo1: string, bar = foo1) { }
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parameterInitializersForwardReferencing1_es6.ts | TypeScript | // @target: es2015
let foo: string = "";
function f1 (bar = foo) { // unexpected compiler error; works at runtime
var foo: number = 2;
return bar; // returns 1
}
function f2 (bar = (baz = foo) => baz) { // unexpected compiler error; works at runtime
var foo: number = 2;
return bar(); // returns 1
}
function f3 (bar = foo, foo = 2) { // correct compiler error, error at runtime
return bar;
}
function f4 (foo, bar = foo) {
return bar
}
function f5 (a = a) {
return a
}
function f6 (async = async) {
return async
}
function f7({[foo]: bar}: any[]) {
let foo: number = 2;
}
class Foo {
constructor(public x = 12, public y = x) {}
}
function f8(foo1: string, bar = foo1) { }
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parametersWithNoAnnotationAreAny.ts | TypeScript | function foo(x) { return x; }
var f = function foo(x) { return x; }
var f2 = (x) => x;
var f3 = <T>(x) => x;
class C {
foo(x) {
return x;
}
}
interface I {
foo(x);
foo2(x, y);
}
var a: {
foo(x);
}
var b = {
foo(x) {
return x;
},
a: function foo(x) {
return x;
},
b: (x) => x
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parentheses.ts | TypeScript | // @noTypesAndSymbols: true
declare const o1: ((...args: any[]) => number);
declare const o2: { b: (...args: any[]) => number };
declare const o3: { b: ((...args: any[]) => (...args: any[]) => number) };
declare const o4: { b: ((...args: any[]) => { c: (...args: any[]) => number } ) };
(o1)(o1 ?? 1);
(o2?.b)(o1 ?? 1);
(o3?.b())(o1 ?? 1);
(o4?.b().c)(o1 ?? 1);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parenthesizedContexualTyping1.ts | TypeScript |
function fun<T>(g: (x: T) => T, x: T): T;
function fun<T>(g: (x: T) => T, h: (y: T) => T, x: T): T;
function fun<T>(g: (x: T) => T, x: T): T {
return g(x);
}
var a = fun(x => x, 10);
var b = fun((x => x), 10);
var c = fun(((x => x)), 10);
var d = fun((((x => x))), 10);
var e = fun(x => x, x => x, 10);
var f = fun((x => x), (x => x), 10);
var g = fun(((x => x)), ((x => x)), 10);
var h = fun((((x => x))), ((x => x)), 10);
// Ternaries in parens
var i = fun((Math.random() < 0.5 ? x => x : x => undefined), 10);
var j = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), 10);
var k = fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10);
var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x)), 10);
var lambda1: (x: number) => number = x => x;
var lambda2: (x: number) => number = (x => x);
type ObjType = { x: (p: number) => string; y: (p: string) => number };
var obj1: ObjType = { x: x => (x, undefined), y: y => (y, undefined) };
var obj2: ObjType = ({ x: x => (x, undefined), y: y => (y, undefined) }); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parenthesizedContexualTyping2.ts | TypeScript | // These tests ensure that in cases where it may *appear* that a value has a type,
// they actually are properly being contextually typed. The way we test this is
// that we invoke contextually typed arguments with type arguments.
// Since 'any' cannot be invoked with type arguments, we should get errors
// back if contextual typing is not taking effect.
type FuncType = (x: <T>(p: T) => T) => typeof x;
function fun<T>(f: FuncType, x: T): T;
function fun<T>(f: FuncType, g: FuncType, x: T): T;
function fun<T>(...rest: any[]): T {
return undefined;
}
var a = fun(x => { x<number>(undefined); return x; }, 10);
var b = fun((x => { x<number>(undefined); return x; }), 10);
var c = fun(((x => { x<number>(undefined); return x; })), 10);
var d = fun((((x => { x<number>(undefined); return x; }))), 10);
var e = fun(x => { x<number>(undefined); return x; }, x => { x<number>(undefined); return x; }, 10);
var f = fun((x => { x<number>(undefined); return x; }),(x => { x<number>(undefined); return x; }), 10);
var g = fun(((x => { x<number>(undefined); return x; })),((x => { x<number>(undefined); return x; })), 10);
var h = fun((((x => { x<number>(undefined); return x; }))),((x => { x<number>(undefined); return x; })), 10);
// Ternaries in parens
var i = fun((Math.random() < 0.5 ? x => { x<number>(undefined); return x; } : x => undefined), 10);
var j = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), 10);
var k = fun((Math.random() < 0.5 ? (x => { x<number>(undefined); return x; }) : (x => undefined)), x => { x<number>(undefined); return x; }, 10);
var l = fun(((Math.random() < 0.5 ? ((x => { x<number>(undefined); return x; })) : ((x => undefined)))),((x => { x<number>(undefined); return x; })), 10);
var lambda1: FuncType = x => { x<number>(undefined); return x; };
var lambda2: FuncType = (x => { x<number>(undefined); return x; });
type ObjType = { x: (p: number) => string; y: (p: string) => number };
var obj1: ObjType = { x: x => (x, undefined), y: y => (y, undefined) };
var obj2: ObjType = ({ x: x => (x, undefined), y: y => (y, undefined) }); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parenthesizedContexualTyping3.ts | TypeScript | // @target: ES6
// Contextual typing for parenthesized substitution expressions in tagged templates.
/**
* tempFun - Can't have fun for too long.
*/
function tempFun<T>(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T;
function tempFun<T>(tempStrs: TemplateStringsArray, g: (x: T) => T, h: (y: T) => T, x: T): T;
function tempFun<T>(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T {
return g(x);
}
var a = tempFun `${ x => x } ${ 10 }`
var b = tempFun `${ (x => x) } ${ 10 }`
var c = tempFun `${ ((x => x)) } ${ 10 }`
var d = tempFun `${ x => x } ${ x => x } ${ 10 }`
var e = tempFun `${ x => x } ${ (x => x) } ${ 10 }`
var f = tempFun `${ x => x } ${ ((x => x)) } ${ 10 }`
var g = tempFun `${ (x => x) } ${ (((x => x))) } ${ 10 }`
var h = tempFun `${ (x => x) } ${ (((x => x))) } ${ undefined }` | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parenthesizedTypes.ts | TypeScript | var a: string;
var a: (string);
var a: ((string) | string | (((string))));
var a: ((((((((((((((((((((((((((((((((((((((((string))))))))))))))))))))))))))))))))))))))));
var b: (x: string) => string;
var b: ((x: (string)) => (string));
var c: string[] | number[];
var c: (string)[] | (number)[];
var c: ((string)[]) | ((number)[]);
var d: (((x: string) => string) | ((x: number) => number))[];
var d: ({ (x: string): string } | { (x: number): number })[];
var d: Array<((x: string) => string) | ((x: number) => number)>;
var d: Array<{ (x: string): string } | { (x: number): number }>;
var d: (Array<{ (x: string): string } | { (x: number): number }>);
var e: typeof a[];
var e: (typeof a)[];
var f: (string) => string;
var f: (string: any) => string;
var g: [string, string];
var g: [(string), string];
var g: [(string), (((typeof a)))];
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parseLinkTag.ts | TypeScript | /** trailing @link tag {@link */
var x;
/** @returns trailing @link tag {@link */
function f() {
return x
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parseRegularExpressionMixedWithComments.ts | TypeScript | var regex1 = / asdf /;
var regex2 = /**// asdf /;
var regex3 = /**///**/ asdf / // should be a comment line
1;
var regex4 = /**// /**/asdf /;
var regex5 = /**// asdf/**/ /; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parseThrowsTag.ts | TypeScript | /** @throws {Error} comment */
function f() {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser.numericSeparators.binary.ts | TypeScript | 0b00_11;
0B0_1;
0b1100_0011;
0B0_11_0101;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser.numericSeparators.decimal.ts | TypeScript | // @target: es5, es2020, es2021
1_000_000_000
1.1_00_01
1e1_0
1e+1_0
1e-1_0
1.1e10_0
1.1e+10_0
1.1e-10_0
12_34_56
1_22_333
1_2.3_4
1_2.3_4e5_6
1_2.3_4e+5_6
1_2.3_4e-5_6
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser.numericSeparators.hex.ts | TypeScript | 0x00_11;
0X0_1;
0x1100_0011;
0X0_11_0101;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser.numericSeparators.octal.ts | TypeScript | 0o00_11;
0O0_1;
0o1100_0011;
0O0_11_0101;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser15.4.4.14-9-2.ts | TypeScript | /// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.4/15.4.4/15.4.4.14/15.4.4.14-9-2.js
* @description Array.prototype.indexOf must return correct index (Number)
*/
function testcase() {
var obj = {toString:function (){return 0}};
var one = 1;
var _float = -(4/3);
var a = new Array(false,undefined,null,"0",obj,-1.3333333333333, "str",-0,true,+0, one, 1,0, false, _float, -(4/3));
if (a.indexOf(-(4/3)) === 14 && // a[14]=_float===-(4/3)
a.indexOf(0) === 7 && // a[7] = +0, 0===+0
a.indexOf(-0) === 7 && // a[7] = +0, -0===+0
a.indexOf(1) === 10 ) // a[10] =one=== 1
{
return true;
}
}
runTestCase(testcase);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509534.ts | TypeScript | "use strict";
var config = require("../config");
module.exports.route = function (server) {
// General Login Page
server.get(config.env.siteRoot + "/auth/login", function (req, res, next) {
// TODO Should render login page that shows auth options
req.redirect("/auth/live");
});
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509546.ts | TypeScript | export class Logger {
public
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509546_1.ts | TypeScript | export class Logger {
public
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509546_2.ts | TypeScript | "use strict";
export class Logger {
public
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509677.ts | TypeScript | var n: { y: string }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509693.ts | TypeScript | if (!module.exports) module.exports = ""; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser509698.ts | TypeScript | // @noLib: true
/// <style requireSemi="on" />
declare function foo(): void;
declare function bar(): void;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser536727.ts | TypeScript | function foo(f: (x: string) => string) {
return f("");
}
var g = (x: string) => x + "blah";
var x = () => g;
foo(g);
foo(() => g);
foo(x);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser579071.ts | TypeScript | var x = /fo(o/; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser596700.ts | TypeScript | var regex2 = /[a-z/]$/i; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser630933.ts | TypeScript | var a = "Hello";
var b = a.match(/\/ver=([^/]+)/);
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser643728.ts | TypeScript | interface C {
foo;
new;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser645086_3.ts | TypeScript | var v = /[\]/]/ | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser645086_4.ts | TypeScript | var v = /[^\]/]/ | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser645484.ts | TypeScript | var c : {
new?(): any;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parser768531.ts | TypeScript | // @allowUnusedLabels: true
{a: 3}
/x/ | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic11.ts | TypeScript | class Outer
{
static public() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic14.ts | TypeScript | class Outer
{
static public<T>() {}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic2.ts | TypeScript | class Outer
{
static public;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic3.ts | TypeScript | class Outer
{
static public = 1;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic4.ts | TypeScript | class Outer
{
static public: number;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessibilityAfterStatic5.ts | TypeScript | class Outer
{
static public
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessors1.ts | TypeScript | // @target: es5
class C {
get Foo() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessors2.ts | TypeScript | // @target: es5
class C {
set Foo(a) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessors3.ts | TypeScript | // @target: es5
var v = { get Foo() { } }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAccessors4.ts | TypeScript | // @target: es5
var v = { set Foo(a) { } }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAdditiveExpression1.ts | TypeScript | m.index+1+m[0].length; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguity1.ts | TypeScript | f(g<A, B>(7)); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguity2.ts | TypeScript | f(g<A, B>7); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguity3.ts | TypeScript | f(g < A, B > +(7)); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguityWithBinaryOperator1.ts | TypeScript | function f1() {
var a, b, c;
if (a < b || b > (c + 1)) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguityWithBinaryOperator2.ts | TypeScript | function f() {
var a, b, c;
if (a < b && b > (c + 1)) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguityWithBinaryOperator3.ts | TypeScript | function f() {
var a, b, c;
if (a < b && b < (c + 1)) { }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserAmbiguityWithBinaryOperator4.ts | TypeScript | function g() {
var a, b, c;
if (a<b, b>(c + 1)) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArgumentList1.ts | TypeScript | export function removeClass (node:HTMLElement, className:string) {
node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) {
return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : '';
});
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression1.ts | TypeScript | var v = []; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression10.ts | TypeScript | var v = [1,1,]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression11.ts | TypeScript | var v = [1,,1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression12.ts | TypeScript | var v = [1,,,1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression13.ts | TypeScript | var v = [1,,1,,1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression14.ts | TypeScript | var v = [,,1,1,,1,,1,1,,1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression15.ts | TypeScript | var v = [,,1,1,,1,,1,1,,1,]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression2.ts | TypeScript | var v = [,]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression3.ts | TypeScript | var v = [,,]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression4.ts | TypeScript | var v = [,,,]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression5.ts | TypeScript | var v = [1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/parserArrayLiteralExpression6.ts | TypeScript | var v = [,1]; | 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.