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/libReferenceDeclarationEmitBundle.ts | TypeScript | // @target: esnext
// @module: amd
// @lib: esnext
// @declaration: true
// @outFile: bundle.js
// @filename: file1.ts
/// <reference lib="dom" preserve="true" />
export declare const elem: HTMLElement;
// @filename: file2.ts
/// <reference lib="dom" preserve="true" />
export {}
declare const elem: HTMLElement; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/libReferenceNoLib.ts | TypeScript | // @target: esnext
// @module: commonjs
// @noLib: true
// @declaration: true
// Test that passing noLib disables <reference lib> resolution.
// @filename: fakelib.ts
interface Object { }
interface Array<T> { }
interface String { }
interface Boolean { }
interface Number { }
interface Function { }
interface RegExp { }
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/libReferenceNoLibBundle.ts | TypeScript | // @target: esnext
// @module: amd
// @noLib: true
// @declaration: true
// @outFile: bundle.js
// Test that passing noLib disables <reference lib> resolution.
// @filename: fakelib.ts
interface Object { }
interface Array<T> { }
interface String { }
interface Boolean { }
interface Number { }
interface Function { }
in... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-1.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @typeRoots: /src/types
// We can find typings in the ./types folder
// @filename: /src/types/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: /src/consumer.ts
/// <reference types="jquery" />
$.foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-14.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @types: jquery
// @typeRoots: /a/types
// @currentDirectory: /a
// @filename: /a/types/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: /a/b/consumer.ts
$.foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-15.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @types: jquery
// @typeRoots: /a/types
// @filename: /a/types/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: /a/types/jquery2/index.d.ts
declare var $2: { foo(): void };
// @filename: /a/b/consumer.ts
$.foo(); // should OK
$2.foo(); // shou... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-3.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /src
// Secondary references are possible
// @filename: /src/node_modules/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: /src/consumer.ts
/// <reference types="jquery" />
$.foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-4.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @typeRoots: /src
// @currentDirectory: test
// Secondary references may be duplicated if they agree in content
// @filename: /node_modules/foo/index.d.ts
/// <reference types="alpha" />
declare var foo: any;
// @filename: /node_modules/foo/node_modules/alph... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-5.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /
// @typeRoots: types
// Secondary references may not be duplicated if they disagree in content
// @filename: /node_modules/foo/index.d.ts
/// <reference types="alpha" />
declare var foo: any;
// @filename: /node_modules/foo/node_modules... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-6.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /
// The primary lookup folder is relative to tsconfig.json, if present
// @filename: /node_modules/@types/alpha/index.d.ts
declare var alpha: { a: string };
// @filename: /src/foo.ts
/// <reference types="alpha" />
var x: string = alpha.... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-7.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /
// Secondary references are possible
// @filename: /src/node_modules/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: /src/consumer.ts
/// <reference types="jquery" />
$.foo();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-8.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @typeRoots: /test/types
// @currentDirectory: /test
// Don't crash in circular library reference situations
// @filename: /test/types/alpha/index.d.ts
/// <reference types="beta" />
declare var alpha: { a: string };
// @filename: /test/types/beta/index.d.ts... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/library-reference-scoped-packages.ts | TypeScript | // @noImplicitReferences: true
// @traceResolution: true
// @typeRoots: types
// @filename: /node_modules/@types/beep__boop/index.d.ts
export const y = 0;
// @filename: /a.ts
/// <reference types="@beep/boop" />
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/linkTagEmit1.ts | TypeScript | // @checkJs: true
// @outdir: foo
// @declaration: true
// @filename: declarations.d.ts
declare namespace NS {
type R = number
}
// @filename: linkTagEmit1.js
/** @typedef {number} N */
/**
* @typedef {Object} D1
* @property {1} e Just link to {@link NS.R} this time
* @property {1} m Wyatt Earp loved {@link N in... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypeWidening.ts | TypeScript | // Widening vs. non-widening literal types
function f1() {
const c1 = "hello"; // Widening type "hello"
let v1 = c1; // Type string
const c2 = c1; // Widening type "hello"
let v2 = c2; // Type string
const c3: "hello" = "hello"; // Type "hello"
let v3 = c3; // Type "hello"
const c4: "... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypes1.ts | TypeScript | // @strictNullChecks: true
let zero: 0 = 0;
let one: 1 = 1;
let two: 2 = 2;
let oneOrTwo: 1 | 2 = <1 | 2>1;
function f1(x: 0 | 1 | 2) {
switch (x) {
case zero:
x;
break;
case one:
x;
break;
case two:
x;
break;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypes2.ts | TypeScript | enum E {
A, B, C
}
let cond: boolean;
function f1(p1 = 1, p2 = "abc", p3 = true, p4 = E.A) {
var v1 = 1;
var v2 = -123;
var v3 = 3 + 4;
var v4 = "abc";
var v5 = "";
var v6 = "abc" + "def";
var v7 = true;
var v8 = E.A;
let x1 = 1;
let x2 = -123;
let x3 = 3 + 4;
let x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypes3.ts | TypeScript | // @strictNullChecks: true
function f1(s: string) {
if (s === "foo") {
s; // "foo"
}
if (s === "foo" || s === "bar") {
s; // "foo" | "bar"
}
}
function f2(s: string) {
switch (s) {
case "foo":
case "bar":
s; // "foo" | "bar"
case "baz":
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypesAndDestructuring.ts | TypeScript | // @strict: true
declare let x: { a: 0 | 1 | undefined };
let { a: a1 } = x;
let { a: a2 = 0 } = x;
let { a: a3 = 2 } = x;
let { a: a4 = 2 as const } = x;
let b1 = x.a;
let b2 = x.a ?? 0;
let b3 = x.a ?? 2;
let b4 = x.a ?? 2 as const;
// Repro from #35693
interface Foo {
bar: 'yo' | 'ha' | undefined;
}
let { ba... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypesAndTypeAssertions.ts | TypeScript | const obj = {
a: "foo" as "foo",
b: <"foo">"foo",
c: "foo"
};
let x1 = 1 as (0 | 1);
let x2 = 1;
let { a = "foo" } = { a: "foo" };
let { b = "foo" as "foo" } = { b: "bar" };
let { c = "foo" } = { c: "bar" as "bar" };
let { d = "foo" as "foo" } = { d: "bar" as "bar" };
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/literalTypesWidenInParameterPosition.ts | TypeScript | class D {
readonly noWiden = 1
constructor(readonly widen = 2) {
this.noWiden = 5; // error
this.widen = 6; // ok
}
}
new D(7); // ok
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localTypes1.ts | TypeScript | // @target: es5
function f1() {
enum E {
A, B, C
}
class C {
x: E;
}
interface I {
x: E;
}
type A = I[];
let a: A = [new C()];
a[0].x = E.B;
return a;
}
function f2() {
function g() {
enum E {
A, B, C
}
class C {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localTypes2.ts | TypeScript | function f1() {
function f() {
class C {
constructor(public x: number, public y: number) { }
}
return C;
}
let C = f();
let v = new C(10, 20);
let x = v.x;
let y = v.y;
}
function f2() {
function f(x: number) {
class C {
public x = x;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localTypes3.ts | TypeScript | function f1() {
function f() {
class C<X, Y> {
constructor(public x: X, public y: Y) { }
}
return C;
}
let C = f();
let v = new C(10, "hello");
let x = v.x;
let y = v.y;
}
function f2() {
function f<X>(x: X) {
class C<Y> {
public x = x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localTypes4.ts | TypeScript | // @allowUnreachableCode: true
function f1() {
// Type parameters are in scope in parameters and return types
function f<T>(x: T): T {
return undefined;
}
}
function f2() {
// Local types are not in scope in parameters and return types
function f(x: T): T {
interface T { }
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localTypes5.ts | TypeScript | function foo<A>() {
class X {
m<B, C>() {
return (function <D>() {
class Y<E> {
}
return new Y<string>();
})<Date>();
}
}
var x = new X();
return x.m<number, boolean>();
}
var x = foo<void>();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/localesObjectArgument.ts | TypeScript | // @target: es2020
const enUS = new Intl.Locale("en-US");
const deDE = new Intl.Locale("de-DE");
const jaJP = new Intl.Locale("ja-JP");
const now = new Date();
const num = 1000;
const bigint = 123456789123456789n;
const str = "";
const readonlyLocales: Readonly<string[]> = ['de-DE', 'ja-JP'];
now.toLocaleString(enU... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAndOperatorWithTypeParameters.ts | TypeScript | // The && operator permits the operands to be of any type and produces a result of the same
// type as the second operand.
function foo<T, U, V/* extends T*/>(t: T, u: U, v: V) {
var r1 = t && t;
var r2 = u && t;
var r3 = v && t;
var r4 = t && u;
var r5 = u && u;
var r6 = v && u;
var r7 =... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment1.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
declare let a: string | undefined
declare let b: string | undefined
declare let c: string | undefined
declare let d: number | undefined
declare let e: number | undefined
declare let f: number | undefined
declare let g: 0 | 1 | 42
declare let h: 0 | 1 | 42
de... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment10.ts | TypeScript | // @target: esnext, es2021, es2020, es2015
var count = 0;
var obj = {};
function incr() {
return ++count;
}
const oobj = {
obj
}
obj[incr()] ??= incr();
oobj["obj"][incr()] ??= incr();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment11.ts | TypeScript | // @strict: true
// @target: esnext, es2020, es2015
let x: string | undefined;
let d: string | undefined;
d ?? (d = x ?? "x")
d.length;
let e: string | undefined;
e ??= x ?? "x"
e.length | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment2.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
interface A {
foo: {
bar(): {
baz: 0 | 1 | 42 | undefined | ''
}
baz: 0 | 1 | 42 | undefined | ''
}
baz: 0 | 1 | 42 | undefined | ''
}
declare const result: A
declare const a: A
declare const b: A
declare const ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment3.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
interface A {
baz: 0 | 1 | 42 | undefined | ''
}
declare const result: A;
declare const a: A;
declare const b: A;
declare const c: A;
(a.baz) &&= result.baz;
(b.baz) ||= result.baz;
(c.baz) ??= result.baz;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment4.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
// @allowUnreachableCode: false
function foo1(results: number[] | undefined) {
(results ||= []).push(100);
}
function foo2(results: number[] | undefined) {
(results ??= []).push(100);
}
function foo3(results: number[] | undefined) {
results ||= ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment5.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
function foo1 (f?: (a: number) => void) {
f ??= (a => a)
f(42)
}
function foo2 (f?: (a: number) => void) {
f ||= (a => a)
f(42)
}
function foo3 (f?: (a: number) => void) {
f &&= (a => a)
f(42)
}
function bar1 (f?: (a: number) => voi... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment6.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
function foo1(results: number[] | undefined, results1: number[] | undefined) {
(results ||= (results1 ||= [])).push(100);
}
function foo2(results: number[] | undefined, results1: number[] | undefined) {
(results ??= (results1 ??= [])).push(100);
}
f... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment7.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
function foo1(results: number[] | undefined, results1: number[] | undefined) {
(results ||= results1 ||= []).push(100);
}
function foo2(results: number[] | undefined, results1: number[] | undefined) {
(results ??= results1 ??= []).push(100);
}
funct... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment8.ts | TypeScript | // @strict: true
// @target: esnext, es2021, es2020, es2015
declare const bar: { value?: number[] } | undefined
function foo1(results: number[] | undefined) {
(results ||= bar?.value ?? []).push(100);
}
function foo2(results: number[] | undefined) {
(results ??= bar?.value ?? []).push(100);
}
function foo3(... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalAssignment9.ts | TypeScript | // @strict: true
declare let x: { a?: boolean };
x.a ??= true;
x.a &&= false;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalNotOperatorWithAnyOtherType.ts | TypeScript | // ! operator on any type
var ANY: any;
var ANY1;
var ANY2: any[] = ["", ""];
var obj: () => {}
var obj1 = { x: "", y: () => { }};
function foo(): any {
var a;
return a;
}
class A {
public a: any;
static foo() {
var a;
return a;
}
}
module M {
export var n: any;
}
var objA = new... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalNotOperatorWithBooleanType.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 ResultIsBoolean1 = !BOOLEAN;
// boolean type literal
var ResultIsBoo... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalNotOperatorWithEnumType.ts | TypeScript | // ! operator on enum type
enum ENUM { A, B, C };
enum ENUM1 { };
// enum type var
var ResultIsBoolean1 = !ENUM;
// enum type expressions
var ResultIsBoolean2 = !ENUM["B"];
var ResultIsBoolean3 = !(ENUM.B + ENUM["C"]);
// multiple ! operators
var ResultIsBoolean4 = !!ENUM;
var ResultIsBoolean5 = !!!(ENUM["B"] + ENU... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalNotOperatorWithNumberType.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 ResultIsBoolean1 = !NUMBER;
var ResultIsBoolean2 = ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalNotOperatorWithStringType.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 ResultIsBoolean1 = !STRING;
var ResultIsB... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalOrExpressionIsContextuallyTyped.ts | TypeScript | // The || operator permits the operands to be of any type.
// If the || expression is contextually typed, the operands are contextually typed by the
// same type and the result is of the best common type of the contextual type and the two
// operand types.
var r: { a: string } = { a: '', b: 123 } || { a: '', b: true }... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalOrExpressionIsNotContextuallyTyped.ts | TypeScript | // The || operator permits the operands to be of any type.
// If the || expression is not contextually typed, the right operand is contextually typed
// by the type of the left operand and the result is of the best common type of the two
// operand types.
var a: (a: string) => string;
// bug 786110
var r = a || ((a)... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/logicalOrOperatorWithTypeParameters.ts | TypeScript | function fn1<T, U>(t: T, u: U) {
var r1 = t || t;
var r2: T = t || t;
var r3 = t || u;
var r4: {} = t || u;
}
function fn2<T, U/* extends T*/, V/* extends T*/>(t: T, u: U, v: V) {
var r1 = t || u;
//var r2: T = t || u;
var r3 = u || u;
var r4: U = u || u;
var r5 = u || v;
var r6... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/looseThisTypeInFunctions.ts | TypeScript | // @noImplicitAny: true
// @noImplicitThis: true
interface I {
n: number;
explicitThis(this: this, m: number): number;
}
interface Unused {
implicitNoThis(m: number): number;
}
class C implements I {
n: number;
explicitThis(this: this, m: number): number {
return this.n + m;
}
impli... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/malformedTags.ts | TypeScript | // @allowJS: true
// @suppressOutputPathCheck: true
// @filename: myFile02.js
/**
* Checks if `value` is classified as an `Array` object.
*
* @type Function
*/
var isArray = Array.isArray;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeAsClauseRelationships.ts | TypeScript | // From original issue #45212:
type Methods<T> = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
type H<T> = T[keyof Methods<T>]; // Ok
// `Filter<T>` only filters out some keys of `T`.
type Filter<T> = { [P in keyof T as T[P] extends Function ? P : never]: T[P] };
// `Modify<T>` might modify some keys ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeAsClauses.ts | TypeScript | // @strict: true
// @declaration: true
// Mapped type 'as N' clauses
type Getters<T> = { [P in keyof T & string as `get${Capitalize<P>}`]: () => T[P] };
type TG1 = Getters<{ foo: string, bar: number, baz: { z: boolean } }>;
// Mapped type with 'as N' clause has no constraint on 'in T' clause
type PropDef<K extends ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints.ts | TypeScript | // @strict: true
function f0<T extends { a: string, b: string }>(obj: Pick<T, Extract<keyof T, 'b'>>) {
obj.b;
}
function f1<T extends { a: string, b: string }>(obj: Pick<T, Exclude<keyof T, 'a'>>) {
obj.b;
}
function f2<T extends { a: string, b: string }, U extends { b: string, c: string }>(obj: Pick<T | U,... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeConstraints2.ts | TypeScript | // @strict: true
// @declaration: true
// @target: es2017
type Mapped1<K extends string> = { [P in K]: { a: P } };
function f1<K extends string>(obj: Mapped1<K>, key: K) {
const x: { a: K } = obj[key];
}
type Mapped2<K extends string> = { [P in K as `get${P}`]: { a: P } };
function f2<K extends string>(obj: Map... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeErrors.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
interface Shape {
name: string;
width: number;
height: number;
visible: boolean;
}
interface Named {
name: string;
}
interface Point {
x: number;
y: number;
}
// Constraint checking
type T00 = { [P in P]: string }; // Error
type T01 = { ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeErrors2.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
// Repros from #17238
type AB = {
a: 'a'
b: 'a'
};
type T1<K extends keyof AB> = { [key in AB[K]]: true };
type T2<K extends 'a'|'b'> = T1<K>[K]; // Error
type R = AB[keyof AB]; // "a"
type T3 = { [key in R]: true };
type T4<K extends 'a'|'b'> = T3[K] // Erro... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeIndexSignatureModifiers.ts | TypeScript | // @strict: true
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/14295
interface Obj1 {
readonly [key: string]: string;
}
type Res1 = Pick<Obj1, keyof Obj1>
interface Obj2 {
concreteProp: 'hello';
readonly [key: string]: string;
}
type Res2 = Pick<Obj2, keyof Obj2>
interface Obj3 {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeInferenceErrors.ts | TypeScript | // @strict: true
// Repro from #19316
type ComputedOf<T> = {
[K in keyof T]: () => T[K];
}
declare function foo<P, C>(options: { props: P, computed: ComputedOf<C> } & ThisType<P & C>): void;
foo({
props: { x: 10, y: 20 },
computed: {
bar(): number {
let z = this.bar;
retu... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeModifiers.ts | TypeScript | // @strictNullChecks: true
// @noimplicitany: true
type T = { a: number, b: string };
type TP = { a?: number, b?: string };
type TR = { readonly a: number, readonly b: string };
type TPR = { readonly a?: number, readonly b?: string };
var v00: "a" | "b";
var v00: keyof T;
var v00: keyof TP;
var v00: keyof TR;
var v00... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeOverlappingStringEnumKeys.ts | TypeScript | // #37859
enum TerrestrialAnimalTypes {
CAT = "cat",
DOG = "dog"
};
enum AlienAnimalTypes {
CAT = "cat",
};
type AnimalTypes = TerrestrialAnimalTypes | AlienAnimalTypes;
interface TerrestrialCat {
type: TerrestrialAnimalTypes.CAT;
address: string;
}
interface AlienCat {
type: AlienAnimalTypes.CAT
pla... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeRelationships.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
function f1<T>(x: T, k: keyof T) {
return x[k];
}
function f2<T, K extends keyof T>(x: T, k: K) {
return x[k];
}
function f3<T, U extends T>(x: T, y: U, k: keyof T) {
x[k] = y[k];
y[k] = x[k]; // Error
}
function f4<T, U extends T, K extends keyof T>... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypeWithAny.ts | TypeScript | // @strict: true
// @declaration: true
type Item = { value: string };
type ItemMap<T> = { [P in keyof T]: Item };
declare let x0: keyof any;
declare let x1: { [P in any]: Item };
declare let x2: { [P in string]: Item };
declare let x3: { [P in keyof any]: Item };
declare let x4: ItemMap<any>;
// Repro from #19152
t... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes1.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
type Item = { a: string, b: number, c: boolean };
type T00 = { [P in "x" | "y"]: number };
type T01 = { [P in "x" | "y"]: P };
type T02 = { [P in "a" | "b"]: Item[P]; }
type T03 = { [P in keyof Item]: Date };
type T10 = { [P in keyof Item]: Item[P] };
type T11 = { [P ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes2.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
function verifyLibTypes<T, K extends keyof T, U>() {
var x1: Partial<T>;
var x1: { [P in keyof T]?: T[P] };
var x2: Readonly<T>;
var x2: { readonly [P in keyof T]: T[P] };
var x3: Pick<T, K>;
var x3: { [P in K]: T[P] };
var x4: Record<K, U>;
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes3.ts | TypeScript | // @declaration: true
class Box<P> {
value: P;
}
type Boxified<T> = {
[K in keyof T]: Box<T[K]>;
}
declare function boxify<T>(obj: T): Boxified<T>;
declare function unboxify<T>(obj: Boxified<T>): T;
interface Bacon {
isPerfect: boolean;
weight: number;
}
interface BoxifiedBacon {
isPerfect: Box... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes4.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
type Box<T> = {
};
type Boxified<T> = {
[P in keyof T]: Box<T[P]>;
};
function boxify<T>(obj: T): Boxified<T> {
if (typeof obj === "object") {
let result = {} as Boxified<T>;
for (let k in obj) {
result[k] = { value: obj[k] };
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes5.ts | TypeScript | // @strict: true
function f<T>(p: Partial<T>, r: Readonly<T>, pr: Partial<Readonly<T>>, rp: Readonly<Partial<T>>) {
let a1: Partial<T> = p;
let a2: Partial<T> = r;
let a3: Partial<T> = pr;
let a4: Partial<T> = rp;
let b1: Readonly<T> = p; // Error
let b2: Readonly<T> = r;
let b3: Readonly<... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypes6.ts | TypeScript | // @strict: true
// @declaration: true
type T00<T> = { [P in keyof T]: T[P] };
type T01<T> = { [P in keyof T]?: T[P] };
type T02<T> = { [P in keyof T]+?: T[P] };
type T03<T> = { [P in keyof T]-?: T[P] };
type T04<T> = { readonly [P in keyof T]: T[P] };
type T05<T> = { readonly [P in keyof T]?: T[P] };
type T06<T> = {... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypesAndObjects.ts | TypeScript | // @strictNullChecks: true
// @declaration: true
function f1<T>(x: Partial<T>, y: Readonly<T>) {
let obj: {};
obj = x;
obj = y;
}
function f2<T>(x: Partial<T>, y: Readonly<T>) {
let obj: { [x: string]: any };
obj = x;
obj = y;
}
function f3<T>(x: Partial<T>) {
x = {};
}
// Repro from #12... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypesArraysTuples.ts | TypeScript | // @strict: true
// @declaration: true
type Box<T> = { value: T };
type Boxified<T> = { [P in keyof T]: Box<T[P]> };
type T00 = Boxified<[number, string?, ...boolean[]]>;
type T01 = Partial<[number, string?, ...boolean[]]>;
type T02 = Required<[number, string?, ...boolean[]]>;
type T10 = Boxified<string[]>;
type T11... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypesGenericTuples.ts | TypeScript | // @strict: true
// @noEmit: true
// Property keys are `number` following the fixed part of a tuple
type K<T> = { [P in keyof T]: P };
type M<T> = { [P in keyof T]: T[P] };
type KA = K<[string, string, boolean]>; // ["0", "1", "2"]
type KB = K<[string, string, ...string[], string]>; // ["0", "1", ...number[], numb... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mappedTypesGenericTuples2.ts | TypeScript | // @strict: true
// @lib: esnext
// @noEmit: true
// https://github.com/microsoft/TypeScript/issues/57389
declare function getT<T>(): T;
Promise.all([getT<string>(), ...getT<any>()]).then((result) => {
const head = result[0]; // string
const tail = result.slice(1); // any[]
tail satisfies string[]; // ok
});
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/memberFunctionOverloadMixingStaticAndInstance.ts | TypeScript | class C {
foo();
static foo(); // error
}
class D {
static foo();
foo(); // error
}
class E<T> {
foo(x: T);
static foo(x: number); // error
}
class F<T> {
static foo(x: number);
foo(x: T); // error
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/memberFunctionsWithPrivateOverloads.ts | TypeScript | class C {
private foo(x: number);
private foo(x: number, y: string);
private foo(x: any, y?: any) { }
private bar(x: 'hi');
private bar(x: string);
private bar(x: number, y: string);
private bar(x: any, y?: any) { }
private static foo(x: number);
private static foo(x: number, y: st... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/memberFunctionsWithPublicOverloads.ts | TypeScript | class C {
public foo(x: number);
public foo(x: number, y: string);
public foo(x: any, y?: any) { }
public bar(x: 'hi');
public bar(x: string);
public bar(x: number, y: string);
public bar(x: any, y?: any) { }
public static foo(x: number);
public static foo(x: number, y: string);
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/memberFunctionsWithPublicPrivateOverloads.ts | TypeScript | class C {
private foo(x: number);
public foo(x: number, y: string); // error
private foo(x: any, y?: any) { }
private bar(x: 'hi');
public bar(x: string); // error
private bar(x: number, y: string);
private bar(x: any, y?: any) { }
private static foo(x: number);
public static foo(x... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergeClassInterfaceAndModule.ts | TypeScript |
interface C1 {}
declare class C1 {}
module C1 {}
declare class C2 {}
interface C2 {}
module C2 {}
declare class C3 {}
module C3 {}
interface C3 {}
module C4 {}
declare class C4 {} // error -- class declaration must precede module declaration
interface C4 {} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergeThreeInterfaces.ts | TypeScript | // interfaces with the same root module should merge
// basic case
interface A {
foo: string;
}
interface A {
bar: number;
}
interface A {
baz: boolean;
}
var a: A;
var r1 = a.foo
var r2 = a.bar;
var r3 = a.baz;
// basic generic case
interface B<T> {
foo: T;
}
interface B<T> {
bar: T;
}
inter... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergeThreeInterfaces2.ts | TypeScript | // two interfaces with the same root module should merge
// root module now multiple module declarations
module M2 {
export interface A {
foo: string;
}
var a: A;
var r1 = a.foo;
var r2 = a.bar;
}
module M2 {
export interface A {
bar: number;
}
export interface A {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergeTwoInterfaces.ts | TypeScript | // two interfaces with the same root module should merge
// basic case
interface A {
foo: string;
}
interface A {
bar: number;
}
var a: A;
var r1 = a.foo
var r2 = a.bar;
// basic generic case
interface B<T> {
baz: string;
foo: T;
}
interface B<T> {
bar: T;
}
var b: B<string>;
var r3 = b.foo
va... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergeTwoInterfaces2.ts | TypeScript | // two interfaces with the same root module should merge
// root module now multiple module declarations
module M2 {
export interface A {
foo: string;
}
var a: A;
var r1 = a.foo
var r2 = a.bar;
}
module M2 {
export interface A {
bar: number;
}
var a: A;
var r1 = a... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedClassInterface.ts | TypeScript | // @declaration: true
// @Filename: file1.ts
declare class C1 { }
interface C1 { }
interface C2 { }
declare class C2 { }
class C3 { }
interface C3 { }
interface C4 { }
class C4 { }
interface C5 {
x1: number;
}
declare class C5 {
x2: number;
}
interface C5 {
x3: number;
}
interface C5 {
x4: ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInheritedClassInterface.ts | TypeScript | interface BaseInterface {
required: number;
optional?: number;
}
class BaseClass {
baseMethod() { }
baseNumber: number;
}
interface Child extends BaseInterface {
additional: number;
}
class Child extends BaseClass {
classNumber: number;
method() { }
}
interface ChildNoBaseClass extends B... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInheritedMembersSatisfyAbstractBase.ts | TypeScript | abstract class BaseClass {
abstract bar: number;
}
class Broken extends BaseClass {}
// declaration merging should satisfy abstract bar
interface IGetters {
bar: number;
}
interface Broken extends IGetters {}
new Broken().bar
class IncorrectlyExtends extends BaseClass {}
interface IncorrectGetters {
bar: stri... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithConflictingPropertyNames.ts | TypeScript | interface A {
x: string; // error
}
interface A {
x: number;
}
module M {
interface A<T> {
x: T;
}
interface A<T> {
x: number; // error
}
}
module M2 {
interface A<T> {
x: T;
}
}
module M2 {
interface A<T> {
x: number; // ok, different declar... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithConflictingPropertyNames2.ts | TypeScript | interface A {
x: string; // error
}
interface A {
x: string; // error
}
module M {
interface A<T> {
x: T;
}
interface A<T> {
x: T; // error
}
}
module M2 {
interface A<T> {
x: T;
}
}
module M2 {
interface A<T> {
x: T; // ok, different declara... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithIndexers.ts | TypeScript | // indexers should behave like other members when merging interface declarations
interface A {
[x: number]: string;
}
interface A {
[x: string]: { length: number };
}
var a: A;
var r = a[1];
var r2 = a['1'];
var r3 = a['hi']; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithIndexers2.ts | TypeScript | // indexers should behave like other members when merging interface declarations
interface A {
[x: number]: string; // error
}
interface A {
[x: string]: { length: string }; // error
}
interface A2 {
[x: number]: string;
'a': number; //error
}
interface A2 {
[x: string]: { length: number };
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithInheritedPrivates.ts | TypeScript | class C {
private x: number;
}
interface A extends C {
y: string;
}
interface A {
z: string;
}
class D implements A { // error
private x: number;
y: string;
z: string;
}
class E implements A { // error
x: number;
y: string;
z: string;
}
var a: A;
var r = a.x; // error | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithInheritedPrivates2.ts | TypeScript | class C {
private x: number;
}
class C2 {
private w: number;
}
interface A extends C {
y: string;
}
interface A extends C2 {
z: string;
}
class D extends C implements A { // error
private w: number;
y: string;
z: string;
}
class E extends C2 implements A { // error
w: number;
y:... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithInheritedPrivates3.ts | TypeScript | class C {
private x: number;
}
class C2 {
private x: number;
}
interface A extends C { // error
y: string;
}
interface A extends C2 {
z: string;
}
class D extends C implements A { // error
y: string;
z: string;
}
module M {
class C {
private x: string;
}
class C2 {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithMultipleBases.ts | TypeScript | // merged interfaces behave as if all extends clauses from each declaration are merged together
// no errors expected
class C {
a: number;
}
class C2 {
b: number;
}
interface A extends C {
y: string;
}
interface A extends C2 {
z: string;
}
class D implements A {
a: number;
b: number;
y:... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithMultipleBases2.ts | TypeScript | // merged interfaces behave as if all extends clauses from each declaration are merged together
// no errors expected
class C {
a: number;
}
class C2 {
b: number;
}
class C3 {
c: string;
}
class C4 {
d: string;
}
interface A extends C, C3 {
y: string;
}
interface A extends C2, C4 {
z: str... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithMultipleBases3.ts | TypeScript | // merged interfaces behave as if all extends clauses from each declaration are merged together
// no errors expected
class C<T> {
a: T;
}
class C2<T> {
b: T;
}
class C3<T> {
c: T;
}
class C4<T> {
d: T;
}
interface A<T> extends C<string>, C3<string> {
y: T;
}
interface A<T> extends C<string>, ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedInterfacesWithMultipleBases4.ts | TypeScript | // merged interfaces behave as if all extends clauses from each declaration are merged together
class C<T> {
a: T;
}
class C2<T> {
b: T;
}
class C3<T> {
c: T;
}
class C4<T> {
d: T;
}
interface A<T> extends C<string>, C3<string> { // error
y: T;
}
interface A<T> extends C<number>, C4<string> {
... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mergedWithLocalValue.ts | TypeScript | // @Filename: a.ts
export type A = "a";
// @Filename: b.ts
import type { A } from "./a";
const A: A = "a";
A.toUpperCase();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/methodSignaturesWithOverloads.ts | TypeScript | // Object type literals permit overloads with optionality but they must match
var c: {
func4?(x: number): number;
func4(s: string): string; // error, mismatched optionality
func5?: {
(x: number): number;
(s: string): string;
};
};
var c2: {
func4<T>(x: T): number;
func4? <T>(s:... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/methodSignaturesWithOverloads2.ts | TypeScript | // Object type literals permit overloads with optionality but they must match
var c: {
func4?(x: number): number;
func4?(s: string): string;
func5?: {
(x: number): number;
(s: string): string;
};
};
// no errors
c.func4 = c.func5;
c.func5 = c.func4;
var c2: {
func4?<T>(x: T): num... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/methodsReturningThis.ts | TypeScript | // @filename: input.js
// @outFile: output.js
// @allowJs: true
function Class()
{
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/missingAndExcessProperties.ts | TypeScript | // Missing properties
function f1() {
var { x, y } = {};
var { x = 1, y } = {};
var { x, y = 1 } = {};
var { x = 1, y = 1 } = {};
}
// Missing properties
function f2() {
var x: number, y: number;
({ x, y } = {});
({ x: x = 1, y } = {});
({ x, y: y = 1 } = {});
({ x: x = 1, y: y = 1 ... | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/mixedPropertyElementAccessAssignmentDeclaration.ts | TypeScript | // Should not crash: #34642
var arr = [];
arr[0].prop[2] = {};
| 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.