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/propertyOverridesAccessors.ts | TypeScript | // @target: es2015
// @useDefineForClassFields: true
class A {
get p() { return 'oh no' }
}
class B extends A {
p = 'yep' // error
}
class C {
_secret = 11
get p() { return this._secret }
set p(value) { this._secret = value }
}
class D extends C {
p = 101 // error
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/propertyOverridesAccessors2.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class Base {
get x() { return 2; }
set x(value) { console.log(`x was set to ${value}`); }
}
class Derived extends Base {
x = 1;
}
const obj = new Derived(); // prints 'x was set to 1'
console.log(obj.x); // 2
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/propertyOverridesAccessors3.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class Animal {
_sound = 'rustling noise in the bushes'
get sound() { return this._sound }
set sound(val) {
this._sound = val;
/* some important code here, perhaps tracking known sounds, etc */
}
makeSound() {
console.log(this... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/propertyOverridesAccessors4.ts | TypeScript | // @target: es5
// @useDefineForClassFields: true
declare class Animal {
get sound(): string
set sound(val: string)
}
class Lion extends Animal {
sound = 'RAWR!' // error here
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/propertyOverridesAccessors5.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class A {
get p() { return 'oh no' }
}
class B extends A {
constructor(public p: string) {
super()
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/propertyOverridesMethod.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class A {
m() { }
}
class B extends A {
m = () => 1
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinClass.ts | TypeScript | // @target: ES5
// no errors
class C {
protected x: string;
protected get y() { return this.x; }
protected set y(x) { this.y = this.x; }
protected foo() { return this.foo; }
protected static x: string;
protected static get y() { return this.x; }
protected static set y(x) { this.y = this.x;... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinNestedClass.ts | TypeScript | // @target: ES5
// no errors
class C {
protected x: string;
protected get y() { return this.x; }
protected set y(x) { this.y = this.x; }
protected foo() { return this.foo; }
protected static x: string;
protected static get y() { return this.x; }
protected static set y(x) { this.y = this.x;... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinNestedSubclass.ts | TypeScript | // @target: ES5
class B {
protected x: string;
protected static x: string;
}
class C extends B {
protected get y() { return this.x; }
protected set y(x) { this.y = this.x; }
protected foo() { return this.x; }
protected static get y() { return this.x; }
protected static set y(x) { this.y =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinNestedSubclass1.ts | TypeScript | class Base {
protected x: string;
method() {
class A {
methoda() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // OK, accessed within thei... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinSubclass.ts | TypeScript | // @target: ES5
// no errors
class B {
protected x: string;
protected static x: string;
}
class C extends B {
protected get y() { return this.x; }
protected set y(x) { this.y = this.x; }
protected foo() { return this.x; }
protected bar() { return this.foo(); }
protected static get y() { r... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinSubclass2.ts | TypeScript | class Base {
protected x: string;
method() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // OK, accessed within their declaring class
d1.x; // OK, accessed within their declaring class
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedClassPropertyAccessibleWithinSubclass3.ts | TypeScript | class Base {
protected x: string;
method() {
this.x; // OK, accessed within their declaring class
}
}
class Derived extends Base {
method1() {
this.x; // OK, accessed within a subclass of the declaring class
super.x; // Error, x is not public
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedInstanceMemberAccessibility.ts | TypeScript | class A {
protected x: string;
protected f(): string {
return "hello";
}
}
class B extends A {
protected y: string;
g() {
var t1 = this.x;
var t2 = this.f();
var t3 = this.y;
var t4 = this.z; // error
var s1 = super.x; // error
var s2 ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedStaticClassPropertyAccessibleWithinSubclass.ts | TypeScript | class Base {
protected static x: string;
static staticMethod() {
Base.x; // OK, accessed within their declaring class
Derived1.x; // OK, accessed within their declaring class
Derived2.x; // OK, accessed within their declaring class
Derived3.x; // Error, redefi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedStaticClassPropertyAccessibleWithinSubclass2.ts | TypeScript | class Base {
protected static x: string;
static staticMethod() {
this.x; // OK, accessed within their declaring class
}
}
class Derived1 extends Base {
static staticMethod1() {
this.x; // OK, accessed within a class derived from their declaring class
super.x; ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/protectedStaticNotAccessibleInClodule.ts | TypeScript | // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error.
class C {
public static foo: string;
protected static bar: string;
}
module C {
export var f = C.foo; // OK
export var b = C.bar; // error
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/prototypePropertyAssignmentMergeAcrossFiles.ts | TypeScript | // @Filename: prototypePropertyAssignmentMergeAcrossFiles.js
// @allowJs: true
// @checkJs: true
// @noEmit: true
function C() {
this.a = 1
}
// @Filename: other.js
C.prototype.foo = function() { return this.a }
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/prototypePropertyAssignmentMergeAcrossFiles2.ts | TypeScript | // @Filename: prototypePropertyAssignmentMergeAcrossFiles2.js
// @allowJs: true
// @checkJs: true
// @noEmit: true
var Ns = {}
Ns.One = function() {};
Ns.Two = function() {};
Ns.One.prototype = {
ok() {},
};
Ns.Two.prototype = {
}
// @Filename: other.js
/**
* @type {Ns.One}
*/
var one;
one.wat;
/**
* @type {Ns.T... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/prototypePropertyAssignmentMergeWithInterfaceMethod.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: lovefield-ts.d.ts
// bug #27352, crashes from github.com/google/lovefield
declare namespace lf {
export interface Transaction {
attach(query: query.Builder): Promise<Array<Object>>
begin(scope: Array<schema.Table>): Promise<void>
commit():... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/prototypePropertyAssignmentMergedTypeReference.ts | TypeScript | // https://github.com/microsoft/TypeScript/issues/33993
// @noEmit: true
// @allowJs: true
// @checkJS: true
// @filename: prototypePropertyAssignmentMergedTypeReference.js
var f = function() {
return 12;
};
f.prototype.a = "a";
/** @type {new () => f} */
var x = f;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/quotedConstructors.ts | TypeScript | class C {
"constructor"() {
console.log(this);
}
}
class D {
'constructor'() {
console.log(this);
}
}
class E {
['constructor']() {
console.log(this);
}
}
new class {
"constructor"() {
console.log(this);
}
};
var o = { "constructor"() {} };
class F {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/reExportAliasMakesInstantiated.ts | TypeScript | declare module pack1 {
const test1: string;
export { test1 };
}
declare module pack2 {
import test1 = pack1.test1;
export { test1 };
}
export import test1 = pack2.test1;
declare module mod1 {
type test1 = string;
export { test1 };
}
declare module mod2 {
import test1 = mod1.test1;
export { test1 };
}
c... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/reExportDefaultExport.ts | TypeScript | // @module: commonjs
// @target: ES5
// @filename: m1.ts
export default function f() {
}
export {f};
// @filename: m2.ts
import foo from "./m1";
import {f} from "./m1";
f();
foo(); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/reExportJsFromTs.ts | TypeScript | // @allowJs: true
// @outDir: out
// @Filename: /lib/constants.js
module.exports = {
str: 'x',
};
// @Filename: /src/constants.ts
import * as tsConstants from "../lib/constants";
export { tsConstants }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/readonlyArraysAndTuples2.ts | TypeScript | // @strict: true
// @declaration: true
// @emitDecoratorMetadata: true
// @experimentalDecorators: true
type T10 = string[];
type T11 = Array<string>;
type T12 = readonly string[];
type T13 = ReadonlyArray<string>;
type T20 = [number, number];
type T21 = readonly [number, number];
declare function f1(ma: string[], r... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/readonlyConstructorAssignment.ts | TypeScript | // Tests that readonly parameter properties behave like regular readonly properties
class A {
constructor(readonly x: number) {
this.x = 0;
}
}
class B extends A {
constructor(x: number) {
super(x);
// Fails, x is readonly
this.x = 1;
}
}
class C extends A {
// Thi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/readonlyInAmbientClass.ts | TypeScript | declare class C{
constructor(readonly x: number);
method(readonly x: number);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/readonlyRestParameters.ts | TypeScript | // @strict: true
// @declaration: true
function f0(a: string, b: string) {
f0(a, b);
f1(a, b);
f2(a, b);
}
function f1(...args: readonly string[]) {
f0(...args); // Error
f1('abc', 'def');
f1('abc', ...args);
f1(...args);
}
function f2(...args: readonly [string, string]) {
f0(...args... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recurringTypeParamForContainerOfBase01.ts | TypeScript | // @declaration: true
interface BoxOfFoo<T extends Foo<T>> {
item: T
}
interface Foo<T extends Foo<T>> {
self: T;
}
interface Bar<T extends Bar<T>> extends Foo<T> {
other: BoxOfFoo<T>;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveInitializer.ts | TypeScript | // number unless otherwise specified
var n1 = n1++;
var n2: number = n2 + n2;
var n3 /* any */ = n3 + n3;
// string unless otherwise specified
var s1 = s1 + '';
var s2 /* any */ = s2 + s2;
var s3 : string = s3 + s3;
var s4 = '' + s4;
// boolean unless otherwise specified
var b1 = !b1;
var b2 = !!b2;
var b3 = !b3 || b... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveIntersectionTypes.ts | TypeScript | type LinkedList<T> = T & { next: LinkedList<T> };
interface Entity {
name: string;
}
interface Product extends Entity {
price: number;
}
var entityList: LinkedList<Entity>;
var s = entityList.name;
var s = entityList.next.name;
var s = entityList.next.next.name;
var s = entityList.next.next.next.name;
var ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveMappedTypes.ts | TypeScript | // @declaration: true
// Recursive mapped types simply appear empty
type Recurse = {
[K in keyof Recurse]: Recurse[K]
}
type Recurse1 = {
[K in keyof Recurse2]: Recurse2[K]
}
type Recurse2 = {
[K in keyof Recurse1]: Recurse1[K]
}
// Repro from #27881
export type Circular<T> = {[P in keyof T]: Circular... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveTypeInGenericConstraint.ts | TypeScript | class G<T> {
x: G<G<T>>; // infinitely expanding type reference
}
class Foo<T extends G<T>> { // error, constraint referencing itself
bar: T;
}
class D<T> {
x: G<G<T>>;
}
var c1 = new Foo<D<string>>(); // ok, circularity in assignment compat check causes success | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveTypeReferences1.ts | TypeScript | // @strict: true
// @declaration: true
type ValueOrArray<T> = T | Array<ValueOrArray<T>>;
const a0: ValueOrArray<number> = 1;
const a1: ValueOrArray<number> = [1, [2, 3], [4, [5, [6, 7]]]];
type HypertextNode = string | [string, { [key: string]: unknown }, ...HypertextNode[]];
const hypertextNode: HypertextNode =
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveTypeReferences2.ts | TypeScript | // @checkjs: true
// @outdir: out/
// @filename: bug39372.js
// @declaration: true
/** @typedef {ReadonlyArray<Json>} JsonArray */
/** @typedef {{ readonly [key: string]: Json }} JsonRecord */
/** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */
/**
* @template T
* @typedef ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveTypesUsedAsFunctionParameters.ts | TypeScript | class List<T> {
data: T;
next: List<List<T>>;
}
class MyList<T> {
data: T;
next: MyList<MyList<T>>;
}
function foo<T>(x: List<T>);
function foo<U>(x: List<U>); // error, duplicate
function foo<T>(x: List<T>) {
}
function foo2<T>(x: List<T>);
function foo2<U>(x: MyList<U>); // ok, nominally compared w... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/recursiveTypesWithTypeof.ts | TypeScript | // The following are errors because of circular references
var c: typeof c;
var c: any;
var d: typeof e;
var d: any;
var e: typeof d;
var e: any;
interface Foo<T> { }
var f: Array<typeof f>;
var f: any;
var f2: Foo<typeof f2>;
var f2: any;
var f3: Foo<typeof f3>[];
var f3: any;
// None of these declarations should ha... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/redeclaredProperty.ts | TypeScript | // @noTypesAndSymbols: true
// @strictNullChecks: true
// @target: esnext
// @useDefineForClassFields: true
class Base {
b = 1;
}
class Derived extends Base {
b;
d = this.b;
constructor() {
super();
this.b = 2;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/redefinedPararameterProperty.ts | TypeScript | // @noTypesAndSymbols: true
// @strictNullChecks: true
// @target: esnext
// @useDefineForClassFields: true
class Base {
a = 1;
}
class Derived extends Base {
b = this.a /*undefined*/;
constructor(public a: number) {
super();
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/reexportClassDefinition.ts | TypeScript | // @module: commonjs
// @Filename: foo1.ts
class x{}
export = x;
// @Filename: foo2.ts
import foo1 = require('./foo1');
export = {
x: foo1
}
// @Filename: foo3.ts
import foo2 = require('./foo2')
class x extends foo2.x {}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/relativePathMustResolve.ts | TypeScript | // @module: commonjs
// @Filename: foo_0.ts
export var x = 42;
// @Filename: foo_1.ts
import foo = require('./test/foo');
var z = foo.x + 10;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/relativePathToDeclarationFile.ts | TypeScript | // @ModuleResolution: classic
// @Filename: test/foo.d.ts
export declare module M2 {
export var x: boolean;
}
// @Filename: test/other.d.ts
export declare module M2 {
export var x: string;
}
// @Filename: test/sub/relMod.d.ts
declare class Test {
constructor(x: number);
}
export = Test;
// @Filename: test/file1.t... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/renamed.ts | TypeScript | // @strict: true
// @Filename: /a.ts
class A { a!: string }
export type { A as B };
// @Filename: /b.ts
export type { B as C } from './a';
// @Filename: /c.ts
import type { C as D } from './b';
const d: D = {};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/requireAssertsFromTypescript.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: ex.d.ts
// based on assert in @types/node
export function art(value: any, message?: string | Error): asserts value;
// @Filename: ex2.d.ts
declare function art(value: any, message?: string | Error): asserts value;
export = art;
// @Filename: 38379.js
co... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/requireOfESWithPropertyAccess.ts | TypeScript | // @allowJs: true
// @checkJs: true
// @strict: true
// @outDir: out
// @declaration: true
// @filename: main.js
const x = require('./ch').x
x
x.grey
x.x.grey
// @filename: ch.js
const x = {
grey: {}
}
export { x }
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/requireTwoPropertyAccesses.ts | TypeScript | // @declaration
// @outdir: out
// @checkjs: true
// @allowjs: true
// @filename: mod.js
module.exports = {
x: {
y: "value"
}
}
// @filename: requireTwoPropertyAccesses.js
const value = require("./mod").x.y
console.log(value)
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementMustBeLast.ts | TypeScript | var [...a, x] = [1, 2, 3]; // Error, rest must be last element
[...a, x] = [1, 2, 3]; // Error, rest must be last element
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern1.ts | TypeScript | //@target: ES6
var a: string, b: number;
[...[a, b = 0]] = ["", 1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern2.ts | TypeScript | //@target: ES6
var a: string, b: number;
[...{ 0: a = "", b }] = ["", 1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern3.ts | TypeScript | var a: string, b: number;
var tuple: [string, number] = ["", 1];
[...[a, b = 0]] = tuple; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern4.ts | TypeScript | var a: string, b: number;
var tuple: [string, number] = ["", 1];
[...{ 0: a = "", b }] = tuple; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithAssignmentPattern5.ts | TypeScript | var s: string, s2: string;
[...[s, s2]] = ["", ""]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithBindingPattern.ts | TypeScript | var [...[a, b]] = [0, 1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithBindingPattern2.ts | TypeScript | var [...{0: a, b }] = [0, 1]; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restElementWithNullInitializer.ts | TypeScript | function foo1([...r] = null) {
}
function foo2([...r] = undefined) {
}
function foo3([...r] = {}) {
}
function foo4([...r] = []) {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restParameterInDownlevelGenerator.ts | TypeScript | // @target: es5
// @lib: es2015
// @downlevelIteration: true
// @noEmitHelpers: true
// https://github.com/Microsoft/TypeScript/issues/30653
function * mergeStringLists(...strings: string[]) {
for (var str of strings);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restPropertyWithBindingPattern.ts | TypeScript | ({...{}} = {});
({...({})} = {});
({...[]} = {});
({...([])} = {}); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/restTuplesFromContextualTypes.ts | TypeScript | // @strict: true
// @declaration: true
declare const t1: [number, boolean, string];
(function (a, b, c){})(...t1);
(function (...x){})(...t1);
(function (a, ...x){})(...t1);
(function (a, b, ...x){})(...t1);
(function (a, b, c, ...x){})(...t1);
declare function f1(cb: (...args: typeof t1) => void): void;
f1((a, b, ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/returnStatements.ts | TypeScript | // all the following should be valid
function fn1(): number { return 1; }
function fn2(): string { return ''; }
function fn3(): void { return undefined; }
function fn4(): void { return; }
function fn5(): boolean { return true; }
function fn6(): Date { return new Date(12); }
function fn7(): any { return null; }
function... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/returnTagTypeGuard.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @checkJs: true
// @lib: esnext
// @Filename: bug25127.js
class Entry {
constructor() {
this.c = 1
}
/**
* @param {any} x
* @return {this is Entry}
*/
isInit(x) {
return true
}
}
class Group {
constructor() {
this.d = 'n... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerAdditiveExpression1.ts | TypeScript | m.index+1+m[0].length; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerClass2.ts | TypeScript |
export class LoggerAdapter implements ILogger {
constructor (public logger: ILogger) {
this._information = this.logger.information();
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerES3NumericLiteral1.ts | TypeScript | 0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerES3NumericLiteral5.ts | TypeScript | 1e0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerES3NumericLiteral7.ts | TypeScript | 1e+0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerEnum1.ts | TypeScript | export enum CodeGenTarget {
ES3 = 0,
ES5 = 1,
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerImportDeclaration1.ts | TypeScript | import TypeScript = TypeScriptServices.TypeScript; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerNonAsciiHorizontalWhitespace.ts | TypeScript | //// [scannerNonAsciiHorizontalWhitespace.ts]
" function f() {}"
//// [scannerNonAsciiHorizontalWhitespace.js]
" function f() {}"
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerNumericLiteral1.ts | TypeScript | // @target: ES5
0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerNumericLiteral5.ts | TypeScript | // @target: ES5
1e0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerNumericLiteral7.ts | TypeScript | // @target: ES5
1e+0 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerS7.2_A1.5_T2.ts | TypeScript | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* NO-BREAK SPACE (U+00A0) between any two tokens is allowed
*
* @path ch07/7.2/S7.2_A1.5_T2.js
* @description Insert real NO-BREAK SPACE between tokens of var x=1
*/
//CHECK#1
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerS7.3_A1.1_T2.ts | TypeScript | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE FEED (U+000A) may occur between any two tokens
*
* @path ch07/7.3/S7.3_A1.1_T2.js
* @description Insert real LINE FEED between tokens of var x=1
*/
//CHECK#1
var
x
=
1;
i... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannerS7.6_A4.2_T1.ts | TypeScript | // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Correct interpretation of RUSSIAN ALPHABET
*
* @path ch07/7.6/S7.6_A4.2_T1.js
* @description Check RUSSIAN CAPITAL ALPHABET
*/
//CHECK#А-Я
var \u0410 = 1;
if (А !== 1) {
$E... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scannertest1.ts | TypeScript | ///<reference path='References.ts' />
class CharacterInfo {
public static isDecimalDigit(c: number): boolean {
return c >= CharacterCodes._0 && c <= CharacterCodes._9;
}
public static isHexDigit(c: number): boolean {
return isDecimalDigit(c) ||
(c >= CharacterCodes.A && c <=... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scopeResolutionIdentifiers.ts | TypeScript | // EveryType used in a nested scope of a different EveryType with the same name, type of the identifier is the one defined in the inner scope
var s: string;
module M1 {
export var s: number;
var n = s;
var n: number;
}
module M2 {
var s: number;
var n = s;
var n: number;
}
function fn() {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/scopedPackagesClassic.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @typeRoots: types
// @moduleResolution: classic
// @filename: /node_modules/@types/see__saw/index.d.ts
export const x = 0;
// @filename: /a.ts
import { x } from "@see/saw";
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/seeTag1.ts | TypeScript | // @declaration: true
interface Foo {
foo: string
}
namespace NS {
export interface Bar {
baz: Foo
}
}
/** @see {Foo} foooo*/
const a = ""
/** @see {NS.Bar} ns.bar*/
const b = ""
/** @see {b} b */
const c = ""
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/seeTag2.ts | TypeScript | // @declaration: true
/** @see {} empty*/
const a = ""
/** @see {aaaaaa} unknown name*/
const b = ""
/** @see {?????} invalid */
const c = ""
/** @see c without brace */
const d = ""
/** @see ?????? wowwwwww*/
const e = ""
/** @see {}*/
const f = ""
/** @see */
const g = ""
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/seeTag3.ts | TypeScript | // @outdir: out/
// @checkJs: true
// @filename: seeTag3.js
/** @see [The typescript web site](https://typescriptlang.org) */
function theWholeThing() {
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/seeTag4.ts | TypeScript | // @checkJs: true
// @allowJs: true
// @outdir: out/
// @filename: seeTag4.js
/**
* @typedef {any} A
*/
/**
* @see {@link A}
* @see {@linkcode A}
* @see {@linkplain A}
*/
let foo;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/shadowedInternalModule.ts | TypeScript | // all errors imported modules conflict with local variables
module A {
export var Point = { x: 0, y: 0 }
export interface Point {
x: number;
y: number;
}
}
module B {
var A = { x: 0, y: 0 };
import Point = A;
}
module X {
export module Y {
export interface Point{
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts | TypeScript | // @declaration: true
function foo(x: 'a');
function foo(x: number) { }
class C {
foo(x: 'a');
foo(x: number);
foo(x: any) { }
}
class C2<T> {
foo(x: 'a');
foo(x: T);
foo(x: any) { }
}
class C3<T extends String> {
foo(x: 'a');
foo(x: T);
foo(x: any) { }
}
interface I {
(x: '... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/specializedSignatureIsSubtypeOfNonSpecializedSignature.ts | TypeScript | // Specialized signatures must be a subtype of a non-specialized signature
// All the below should not be errors
function foo(x: 'a');
function foo(x: string);
function foo(x: any) { }
class C {
foo(x: 'a');
foo(x: string);
foo(x: any) { }
}
class C2<T> {
foo(x: 'a');
foo(x: string);
foo(x: T... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/specializedSignatureWithOptional.ts | TypeScript | declare function f(x?: "hi"): void;
declare function f(x?: string): void; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spellingUncheckedJS.ts | TypeScript | // @noEmit: true
// @allowJs: true
// @filename: spellingUncheckedJS.js
export var inModule = 1
inmodule.toFixed()
function f() {
var locals = 2 + true
locale.toFixed()
// @ts-expect-error
localf.toExponential()
// @ts-expect-error
"this is fine"
}
class Classe {
non = 'oui'
methode() {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadContextualTypedBindingPattern.ts | TypeScript | // #18308
interface Person {
naam: string,
age: number
}
declare const bob: Person
declare const alice: Person
// [ts] Initializer provides no value for this binding element and the binding element has no default value.
const { naam, age } = {...bob, ...alice}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadDuplicate.ts | TypeScript | // @strict: true
// @declaration: true
// Repro from #44438
declare let a: { a: string };
declare let b: { a?: string };
declare let c: { a: string | undefined };
declare let d: { a?: string | undefined };
declare let t: boolean;
let a1 = { a: 123, ...a }; // string (Error)
let b1 = { a: 123, ...b }; // string | ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadDuplicateExact.ts | TypeScript | // @strict: true
// @exactOptionalPropertyTypes: true
// @declaration: true
// Repro from #44438
declare let a: { a: string };
declare let b: { a?: string };
declare let c: { a: string | undefined };
declare let d: { a?: string | undefined };
declare let t: boolean;
let a1 = { a: 123, ...a }; // string (Error)
let... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadExcessProperty.ts | TypeScript | type A = { a: string, b: string };
const extra1 = { a: "a", b: "b", extra: "extra" };
const a1: A = { ...extra1 }; // spread should not give excess property errors
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadMethods.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: false
class K {
p = 12;
m() { }
get g() { return 0; }
}
interface I {
p: number;
m(): void;
readonly g: number;
}
let k = new K()
let sk = { ...k };
let ssk = { ...k, ...k };
sk.p;
sk.m(); // error
sk.g; // error
ssk.p;
ssk.m(); // error
ssk.g; /... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadNonObject1.ts | TypeScript | // @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/45493
type S = `${number}`;
const b = {
c: (["4"] as S[]).map(function (s) {
const a = { ...s, y: 6 };
}),
};
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadNonPrimitive.ts | TypeScript | declare let o: object;
const x: { a: number, b: number } = { a: 1, ...o, b: 2 };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadObjectOrFalsy.ts | TypeScript | // @strict: true
// @declaration: true
function f1<T>(a: T & undefined) {
return { ...a }; // Error
}
function f2<T>(a: T | T & undefined) {
return { ...a };
}
function f3<T extends undefined>(a: T) {
return { ...a }; // Error
}
function f4<T extends undefined>(a: object | T) {
return { ...a };
}
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadOverwritesProperty.ts | TypeScript | // without strict null checks, none of these should be an error
declare var ab: { a: number, b: number };
declare var abq: { a: number, b?: number };
var unused1 = { b: 1, ...ab }
var unused2 = { ...ab, ...ab }
var unused3 = { b: 1, ...abq }
function g(obj: { x: number | undefined }) {
return { x: 1, ...obj };
}
f... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadOverwritesPropertyStrict.ts | TypeScript | // @strict: true
declare var ab: { a: number, b: number };
declare var abq: { a: number, b?: number };
var unused1 = { b: 1, ...ab } // error
var unused2 = { ...ab, ...ab } // ok, overwritten error doesn't apply to spreads
var unused3 = { b: 1, ...abq } // ok, abq might have b: undefined
var unused4 = { ...ab, b: 1 } /... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadTypeVariable.ts | TypeScript | function f1<T extends number>(arg: T) {
return { ...arg };
}
function f2<T extends string[]>(arg: T) {
return { ...arg }
}
function f3<T extends number | string[]>(arg: T) {
return { ...arg }
}
function f4<T extends number | { [key: string]: any }>(arg: T) {
return { ...arg }
}
function f5<T extends string[... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadUnion.ts | TypeScript | var union: { a: number } | { b: string };
var o3: { a: number } | { b: string };
var o3 = { ...union };
var o4: { a: boolean } | { b: string , a: boolean};
var o4 = { ...union, a: false };
var o5: { a: number } | { b: string } | { a: number, b: string };
var o5 = { ...union, ...union }; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/spreadUnion2.ts | TypeScript | // @strictNullChecks: true
declare const undefinedUnion: { a: number } | undefined;
declare const nullUnion: { b: number } | null;
var o1: {} | { a: number };
var o1 = { ...undefinedUnion };
var o2: {} | { b: number };
var o2 = { ...nullUnion };
var o3: {} | { a: number } | { b: number } | { a: number, b: number };... | 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.