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/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts | TypeScript | module A {
export class Point {
x: number;
y: number;
}
export var Origin: Point = { x: 0, y: 0 };
export class Point3d extends Point {
z: number;
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
export class Line<TPoint extends Point>{
constructor(public start: TPoint, public end: TPoint) { }
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts | TypeScript | module A {
class Point {
x: number;
y: number;
}
export class points {
[idx: number]: Point;
[idx: string]: Point;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts | TypeScript | module A {
class Point {
x: number;
y: number;
}
export var Origin: Point = { x: 0, y: 0 };
export class Point3d extends Point {
z: number;
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
export class Line<TPoint extends Point>{
constructor(public start: TPoint, public end: TPoint) { }
static fromorigin2d(p: Point): Line<Point>{
return null;
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts | TypeScript | module A {
export class Point {
x: number;
y: number;
}
export class Line {
constructor(public start: Point, public end: Point) { }
}
export function fromOrigin(p: Point): Line {
return new Line({ x: 0, y: 0 }, p);
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts | TypeScript | module A {
class Point {
x: number;
y: number;
}
export class Line {
constructor(public start: Point, public end: Point) { }
}
export function fromOrigin(p: Point): Line {
return new Line({ x: 0, y: 0 }, p);
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts | TypeScript | module A {
export class Point {
x: number;
y: number;
}
class Line {
constructor(public start: Point, public end: Point) { }
}
export function fromOrigin(p: Point): Line {
return new Line({ x: 0, y: 0 }, p);
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
}
export var Origin: Point = { x: 0, y: 0 };
export interface Point3d extends Point {
z: number;
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
export interface Line<TPoint extends Point>{
new (start: TPoint, end: TPoint);
start: TPoint;
end: TPoint;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportInterfaceWithInaccessibleTypeInIndexerTypeAnnotations.ts | TypeScript | module A {
interface Point {
x: number;
y: number;
}
export interface points {
[idx: number]: Point;
[idx: string]: Point;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts | TypeScript | module A {
interface Point {
x: number;
y: number;
}
export var Origin: Point = { x: 0, y: 0 };
export interface Point3d extends Point {
z: number;
}
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
export interface Line<TPoint extends Point>{
new (start: TPoint, end: TPoint);
start: TPoint;
end: TPoint;
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportModuleWithAccessibleTypesOnItsExportedMembers.ts | TypeScript | module A {
export class Point {
constructor(public x: number, public y: number) { }
}
export module B {
export var Origin: Point = new Point(0, 0);
export class Line {
constructor(start: Point, end: Point) {
}
static fromOrigin(p: Point) {
return new Line({ x: 0, y: 0 }, p);
}
}
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts | TypeScript | module A {
class Point {
constructor(public x: number, public y: number) { }
}
export var Origin: Point = { x: 0, y: 0 };
export var Unity = { start: new Point(0, 0), end: new Point(1, 0) };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts | TypeScript | module A {
class Point {
constructor(public x: number, public y: number) { }
}
export var UnitSquare : {
top: { left: Point, right: Point },
bottom: { left: Point, right: Point }
} = null;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts | TypeScript | module A {
class B {
id: number;
}
export var beez: Array<B>;
export var beez2 = new Array<B>();
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportVariableWithAccessibleTypeInTypeAnnotation.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
}
// valid since Point is exported
export var Origin: Point = { x: 0, y: 0 };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ExportVariableWithInaccessibleTypeInTypeAnnotation.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
}
// valid since Point is exported
export var Origin: Point = { x: 0, y: 0 };
interface Point3d extends Point {
z: number;
}
// invalid Point3d is not exported
export var Origin3d: Point3d = { x: 0, y: 0, z: 0 };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionAndModuleWithSameNameAndCommonRoot.ts | TypeScript | // @filename: function.ts
module A {
export function Point() {
return { x: 0, y: 0 };
}
}
// @filename: module.ts
module A {
export module Point {
export var Origin = { x: 0, y: 0 };
}
}
// @filename: test.ts
var fn: () => { x: number; y: number };
var fn = A.Point;
var cl: { x: number; y: number; }
var cl = A.Point();
var cl = A.Point.Origin; // not expected to be an error.
// @filename: simple.ts
module B {
export function Point() {
return { x: 0, y: 0 };
}
export module Point {
export var Origin = { x: 0, y: 0 };
}
}
var fn: () => { x: number; y: number };
var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected
var cl: { x: number; y: number; }
var cl = B.Point();
var cl = B.Point.Origin;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionAndModuleWithSameNameAndDifferentCommonRoot.ts | TypeScript | // @filename: function.ts
module A {
export function Point() {
return { x: 0, y: 0 };
}
}
// @filename: module.ts
module B {
export module Point {
export var Origin = { x: 0, y: 0 };
}
}
// @filename: test.ts
var fn: () => { x: number; y: number };
var fn = A.Point;
var cl: { x: number; y: number; }
var cl = B.Point.Origin;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration11_es6.ts | TypeScript | // @target: es6
function * yield() {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration13_es6.ts | TypeScript | // @target: es6
function * foo() {
// Legal to use 'yield' in a type context.
var v: yield;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration1_es6.ts | TypeScript | // @target: es6
function * foo() {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration2_es6.ts | TypeScript | // @target: es6
function f(yield) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration3_es6.ts | TypeScript | // @target: es6
function f(yield = yield) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration4_es6.ts | TypeScript | // @target: es6
function yield() {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration6_es6.ts | TypeScript | // @target: es6
function*foo(a = yield) {
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration7_es6.ts | TypeScript | // @target: es6
function*bar() {
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration8_es6.ts | TypeScript | var v = { [yield]: foo } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionDeclaration9_es6.ts | TypeScript | // @target: es6
function * foo() {
var v = { [yield]: foo }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionExpression1_es6.ts | TypeScript | // @target: es6
var v = function * () { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionExpression2_es6.ts | TypeScript | // @target: es6
var v = function * foo() { } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionPropertyAssignments1_es6.ts | TypeScript | // @target: es6
var v = { *foo() { } } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/FunctionPropertyAssignments5_es6.ts | TypeScript | // @target: es6
var v = { *[foo()]() { } } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/InvalidNonInstantiatedModule.ts | TypeScript | module M {
export interface Point { x: number; y: number }
}
var m = M; // Error, not instantiated can not be used as var
var x: typeof M; // Error only a namespace
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/MemberFunctionDeclaration1_es6.ts | TypeScript | // @target: es6
class C {
*foo() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/MemberFunctionDeclaration2_es6.ts | TypeScript | // @target: es6
class C {
public * foo() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/MemberFunctionDeclaration3_es6.ts | TypeScript | // @target: es6
class C {
*[foo]() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/MemberFunctionDeclaration7_es6.ts | TypeScript | // @target: es6
class C {
*foo<T>() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleAndClassWithSameNameAndCommonRoot.ts | TypeScript | // @Filename: module.ts
module X.Y {
export module Point {
export var Origin = new Point(0, 0);
}
}
// @Filename: classPoint.ts
module X.Y {
// duplicate identifier
export class Point {
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
x: number;
y: number;
}
}
// @Filename: simple.ts
module A {
export var Instance = new A();
}
// duplicate identifier
class A {
id: string;
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleAndEnumWithSameNameAndCommonRoot.ts | TypeScript | module enumdule {
export class Point {
constructor(public x: number, public y: number) { }
}
}
enum enumdule {
Red, Blue
}
var x: enumdule;
var x = enumdule.Red;
var y: { x: number; y: number };
var y = new enumdule.Point(0, 0); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleAndFunctionWithSameNameAndCommonRoot.ts | TypeScript | // @filename: module.ts
module A {
export module Point {
export var Origin = { x: 0, y: 0 };
}
}
// @filename: function.ts
module A {
// duplicate identifier error
export function Point() {
return { x: 0, y: 0 };
}
}
// @filename: simple.ts
module B {
export module Point {
export var Origin = { x: 0, y: 0 };
}
// duplicate identifier error
export function Point() {
return { x: 0, y: 0 };
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleWithExportedAndNonExportedClasses.ts | TypeScript | module A {
export class A {
id: number;
name: string;
}
export class AG<T, U>{
id: T;
name: U;
}
class A2 {
id: number;
name: string;
}
class AG2<T, U>{
id: T;
name: U;
}
}
// no errors expected, these are all exported
var a: { id: number; name: string };
var a = new A.A();
var AG = new A.AG<number, string>()
// errors expected, these are not exported
var a2 = new A.A2();
var ag2 = new A.A2<string, number>();
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleWithExportedAndNonExportedEnums.ts | TypeScript | module A {
export enum Color { Red, Blue }
enum Day { Monday, Tuesday }
}
// not an error since exported
var a: A.Color = A.Color.Red;
// error not exported
var b = A.Day.Monday;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleWithExportedAndNonExportedFunctions.ts | TypeScript | module A {
export function fn(s: string) {
return true;
}
export function fng<T, U>(s: T): U {
return null;
}
function fn2(s: string) {
return false;
}
function fng2<T, U>(s: T): U {
return null;
}
}
// these should not be errors since the functions are exported
var fn: (s: string) => boolean;
var fn = A.fn;
var fng: <T, U>(s: T) => U;
var fng = A.fng; // bug 838015
// these should be errors since the functions are not exported
var fn2 = A.fn2;
var fng2 = A.fng2; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleWithExportedAndNonExportedImportAlias.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
}
interface Point3d extends Point {
z: number;
}
}
module B {
export class Line {
constructor(public start: A.Point, public end: A.Point) { }
}
}
module Geometry {
export import Points = A;
import Lines = B;
export var Origin: Points.Point = { x: 0, y: 0 };
// this is valid since B.Line _is_ visible outside Geometry
export var Unit: Lines.Line = new Lines.Line(Origin, { x: 1, y: 0 });
}
// expected to work since all are exported
var p: { x: number; y: number };
var p: Geometry.Points.Point;
var p = Geometry.Origin;
var line: { start: { x: number; y: number }; end: { x: number; y: number; } };
var line = Geometry.Unit;
// not expected to work since non are exported
var line = Geometry.Lines.Line;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/ModuleWithExportedAndNonExportedVariables.ts | TypeScript | module A {
export var x = 'hello world'
var y = 12;
}
var x: string;
var x = A.x;
// Error, since y is not exported
var y = A.y;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/Protected3.ts | TypeScript | class C {
protected constructor() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/Protected5.ts | TypeScript | class C {
protected static m() { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/Protected8.ts | TypeScript | interface I {
protected
p
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/Protected9.ts | TypeScript | class C {
constructor(protected p) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TupleType1.ts | TypeScript | var v: [number] | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TupleType2.ts | TypeScript | var v: [number, string] | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TupleType3.ts | TypeScript | var v: [] | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TupleType5.ts | TypeScript | var v: [number,] | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedAndNonExportedClassesOfTheSameName.ts | TypeScript | module A {
export class Point {
x: number;
y: number;
}
}
module A {
class Point {
fromCarthesian(p: A.Point) {
return { x: p.x, y: p.y };
}
}
}
// ensure merges as expected
var p: { x: number; y: number; };
var p: A.Point;
module X.Y.Z {
export class Line {
length: number;
}
}
module X {
export module Y {
export module Z {
class Line {
name: string;
}
}
}
}
// ensure merges as expected
var l: { length: number; }
var l: X.Y.Z.Line;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedAndNonExportedInterfacesOfTheSameName.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
toCarth(): Point;
}
}
module A {
interface Point {
fromCarth(): Point;
}
}
// ensure merges as expected
var p: { x: number; y: number; toCarth(): A.Point; };
var p: A.Point;
module X.Y.Z {
export interface Line {
new (start: A.Point, end: A.Point);
}
}
module X {
export module Y.Z {
interface Line {
start: A.Point;
end: A.Point;
}
}
}
// ensure merges as expected
var l: { new (s: A.Point, e: A.Point); }
var l: X.Y.Z.Line;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.ts | TypeScript | //@filename: part1.ts
module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
export var Origin: Point = { x: 0, y: 0 };
}
//@filename: part2.ts
module A {
// not a collision, since we don't export
var Origin: string = "0,0";
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
}
}
}
//@filename: part3.ts
// test the merging actually worked
var o: { x: number; y: number };
var o: A.Point;
var o = A.Origin;
var o = A.Utils.mirror(o);
var p: { tl: A.Point; br: A.Point };
var p: A.Utils.Plane;
var p = new A.Utils.Plane(o, { x: 1, y: 1 });
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedClassesOfTheSameName.ts | TypeScript | module A {
export class Point {
x: number;
y: number;
}
}
module A{
// expected error
export class Point {
origin: number;
angle: number;
}
}
module X.Y.Z {
export class Line {
length: number;
}
}
module X {
export module Y {
export module Z {
// expected error
export class Line {
name: string;
}
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedInterfacesOfTheSameName.ts | TypeScript | module A {
export interface Point {
x: number;
y: number;
toCarth(): Point;
}
}
module A {
export interface Point {
fromCarth(): Point;
}
}
// ensure merges as expected
var p: { x: number; y: number; toCarth(): A.Point; fromCarth(): A.Point; };
var p: A.Point;
module X.Y.Z {
export interface Line {
new (start: A.Point, end: A.Point);
}
}
module X {
export module Y.Z {
export interface Line {
start: A.Point;
end: A.Point;
}
}
}
// ensure merges as expected
var l: { start: A.Point; end: A.Point; new (s: A.Point, e: A.Point); }
var l: X.Y.Z.Line;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.ts | TypeScript | //@filename: part1.ts
export module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
export var Origin: Point = { x: 0, y: 0 };
}
//@filename: part2.ts
export module A {
// collision with 'Origin' var in other part of merged module
export var Origin: Point = { x: 0, y: 0 };
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
}
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts | TypeScript | module A.B {
export var x: number;
}
module A{
module B {
export var x: string;
}
}
// ensure the right var decl is exported
var x: number;
var x = A.B.x;
module X.Y.Z {
export class Line {
length: number;
}
}
module X {
export module Y {
module Z {
export class Line {
name: string;
}
}
}
}
// make sure merging works as expected
var l: { length: number };
var l: X.Y.Z.Line;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.ts | TypeScript | //@filename: part1.ts
module Root {
export module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
}
}
//@filename: part2.ts
module otherRoot {
export module A {
// have to be fully qualified since in different root
export var Origin: Root.A.Point = { x: 0, y: 0 };
export module Utils {
export class Plane {
constructor(public tl: Root.A.Point, public br: Root.A.Point) { }
}
}
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TwoInternalModulesWithTheSameNameAndSameCommonRoot.ts | TypeScript | //@filename: part1.ts
module A {
export interface Point {
x: number;
y: number;
}
export module Utils {
export function mirror<T extends Point>(p: T) {
return { x: p.y, y: p.x };
}
}
}
//@filename: part2.ts
module A {
export var Origin: Point = { x: 0, y: 0 };
export module Utils {
export class Plane {
constructor(public tl: Point, public br: Point) { }
}
}
}
//@filename: part3.ts
// test the merging actually worked
var o: { x: number; y: number };
var o: A.Point;
var o = A.Origin;
var o = A.Utils.mirror(o);
var p: { tl: A.Point; br: A.Point };
var p: A.Utils.Plane;
var p = new A.Utils.Plane(o, { x: 1, y: 1 });
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TypeGuardWithArrayUnion.ts | TypeScript | class Message {
value: string;
}
function saySize(message: Message | Message[]) {
if (message instanceof Array) {
return message.length; // Should have type Message[] here
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/TypeGuardWithEnumUnion.ts | TypeScript | enum Color { R, G, B }
function f1(x: Color | string) {
if (typeof x === "number") {
var y = x;
var y: Color;
}
else {
var z = x;
var z: string;
}
}
function f2(x: Color | string | string[]) {
if (typeof x === "object") {
var y = x;
var y: string[];
}
if (typeof x === "number") {
var z = x;
var z: Color;
}
else {
var w = x;
var w: string | string[];
}
if (typeof x === "string") {
var a = x;
var a: string;
}
else {
var b = x;
var b: Color | string[];
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration10_es6.ts | TypeScript | // @target:es6
let a: number = 1 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration12_es6.ts | TypeScript | // @target:es6
let
x | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration3_es6.ts | TypeScript | // @target:es6
const a = 1 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration5_es6.ts | TypeScript | // @target:es6
const a: number = 1 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration6_es6.ts | TypeScript | // @target:es6
let | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration7_es6.ts | TypeScript | // @target:es6
let a | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration8_es6.ts | TypeScript | // @target:es6
let a = 1 | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/VariableDeclaration9_es6.ts | TypeScript | // @target:es6
let a: number | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression10_es6.ts | TypeScript | // @target: es6
var v = { * foo() {
yield(foo);
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression11_es6.ts | TypeScript | // @target: es6
class C {
*foo() {
yield(foo);
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression13_es6.ts | TypeScript | // @target: es6
function* foo() { yield } | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression19_es6.ts | TypeScript | // @target: es6
function*foo() {
function bar() {
function* quux() {
yield(foo);
}
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression1_es6.ts | TypeScript | // @target: es6
yield; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression3_es6.ts | TypeScript | // @target: es6
function* foo() {
yield
yield
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression4_es6.ts | TypeScript | // @target: es6
function* foo() {
yield;
yield;
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression6_es6.ts | TypeScript | // @target: es6
function* foo() {
yield*foo
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression7_es6.ts | TypeScript | // @target: es6
function* foo() {
yield foo
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression8_es6.ts | TypeScript | // @target: es6
yield(foo);
function* foo() {
yield(foo);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldExpression9_es6.ts | TypeScript | // @target: es6
var v = function*() {
yield(foo);
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldStarExpression1_es6.ts | TypeScript | // @target: es6
yield * []; | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/YieldStarExpression4_es6.ts | TypeScript | // @target: es6
function *g() {
yield * [];
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/abstractProperty.ts | TypeScript | // @target: es2015,esnext
// @useDefineForClassFields: true
abstract class A {
protected abstract x: string;
public foo() {
console.log(this.x);
}
}
class B extends A {
protected x = 'B.x';
}
class C extends A {
protected get x() { return 'C.x' };
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorWithES5.ts | TypeScript | // @target: ES5
class C {
get x() {
return 1;
}
}
class D {
set x(v) {
}
}
var x = {
get a() { return 1 }
}
var y = {
set b(v) { }
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorWithMismatchedAccessibilityModifiers.ts | TypeScript | // @target: ES5
class C {
get x() {
return 1;
}
private set x(v) {
}
}
class D {
protected get x() {
return 1;
}
private set x(v) {
}
}
class E {
protected set x(v) {
}
get x() {
return 1;
}
}
class F {
protected static set x(v) {
}
static get x() {
return 1;
}
} | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsAreNotContextuallyTyped.ts | TypeScript | // accessors are not contextually typed
class C {
set x(v: (a: string) => string) {
}
get x() {
return (x: string) => "";
}
}
var c: C;
var r = c.x(''); // string | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideMethod.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class A {
m() { }
}
class B extends A {
get m() { return () => 1 }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class A {
p = 'yep'
}
class B extends A {
get p() { return 'oh no' } // error
}
class C {
p = 101
}
class D extends C {
_secret = 11
get p() { return this._secret } // error
set p(value) { this._secret = value } // error
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty2.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
class Base {
x = 1;
}
class Derived extends Base {
get x() { return 2; } // should be an error
set x(value) { console.log(`x was set to ${value}`); }
}
const obj = new Derived(); // nothing printed
console.log(obj.x); // number
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty3.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
declare class Animal {
sound: string
}
class Lion extends Animal {
_sound = 'grrr'
get sound() { return this._sound } // error here
set sound(val) { this._sound = val }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty4.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
declare class Animal {
sound: string;
}
class Lion extends Animal {
_sound = 'roar'
get sound(): string { return this._sound }
set sound(val: string) { this._sound = val }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty5.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: true
interface I {
p: number
}
interface B extends I { }
class B { }
class C extends B {
get p() { return 1 }
set p(value) { }
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty6.ts | TypeScript | // @target: esnext
// @useDefineForClassFields: false
class A {
p = 'yep'
}
class B extends A {
get p() { return 'oh no' } // error
}
class C {
p = 101
}
class D extends C {
_secret = 11
get p() { return this._secret } // error
set p(value) { this._secret = value } // error
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty8.ts | TypeScript | // @target: es2019
type Types = 'boolean' | 'unknown' | 'string';
type Properties<T extends { [key: string]: Types }> = {
readonly [key in keyof T]: T[key] extends 'boolean' ? boolean : T[key] extends 'string' ? string : unknown
}
type AnyCtor<P extends object> = new (...a: any[]) => P
declare function classWithProperties<T extends { [key: string]: Types }, P extends object>(properties: T, klass: AnyCtor<P>): {
new(): P & Properties<T>;
prototype: P & Properties<T>
};
const Base = classWithProperties({
get x() { return 'boolean' as const },
y: 'string',
}, class Base {
});
class MyClass extends Base {
get x() {
return false;
}
get y() {
return 'hi'
}
}
const mine = new MyClass();
const value = mine.x;
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/accessorsOverrideProperty9.ts | TypeScript | // @strict: true
// @target: es2017
// #41347, based on microsoft/rushstack
// Mixin utilities
export type Constructor<T = {}> = new (...args: any[]) => T;
export type PropertiesOf<T> = { [K in keyof T]: T[K] };
interface IApiItemConstructor extends Constructor<ApiItem>, PropertiesOf<typeof ApiItem> {}
// Base class
class ApiItem {
public get members(): ReadonlyArray<ApiItem> {
return [];
}
}
// Normal subclass
class ApiEnumMember extends ApiItem {
}
// Mixin base class
interface ApiItemContainerMixin extends ApiItem {
readonly members: ReadonlyArray<ApiItem>;
}
function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
baseClass: TBaseClass
): TBaseClass & (new (...args: any[]) => ApiItemContainerMixin) {
abstract class MixedClass extends baseClass implements ApiItemContainerMixin {
public constructor(...args: any[]) {
super(...args);
}
public get members(): ReadonlyArray<ApiItem> {
return [];
}
}
return MixedClass;
}
// Subclass inheriting from mixin
export class ApiEnum extends ApiItemContainerMixin(ApiItem) {
// This worked prior to TypeScript 4.0:
public get members(): ReadonlyArray<ApiEnumMember> {
return [];
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/additionOperatorWithAnyAndEveryType.ts | TypeScript | function foo() { }
class C {
public a: string;
static foo() { }
}
enum E { a, b, c }
module M { export var a }
var a: any;
var b: boolean;
var c: number;
var d: string;
var e: Object;
// any as left operand, result is type Any except plusing string
var r1 = a + a;
var r2 = a + b;
var r3 = a + c;
var r4 = a + d;
var r5 = a + e;
// any as right operand, result is type Any except plusing string
var r6 = b + a;
var r7 = c + a;
var r8 = d + a;
var r9 = e + a;
// other cases
var r10 = a + foo;
var r11 = a + foo();
var r12 = a + C;
var r13 = a + new C();
var r14 = a + E;
var r15 = a + E.a;
var r16 = a + M;
var r17 = a + '';
var r18 = a + 123;
var r19 = a + { a: '' };
var r20 = a + ((a: string) => { return a }); | willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/additionOperatorWithConstrainedTypeParameter.ts | TypeScript | // test for #17069
function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k: K) {
n = n + v[k];
n += v[k]; // += should work the same way
}
function realSum<T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) {
for (const v of vs) {
n = n + v[k];
n += v[k];
}
}
| willcrichton/ilc-swc | 1 | Rust | willcrichton | Will Crichton | Brown University | |
crates/swc_ecma_parser/tests/tsc/additionOperatorWithInvalidOperands.ts | TypeScript | function foo() { }
class C {
public a: string;
static foo() { }
}
enum E { a, b, c }
module M { export var a }
var a: boolean;
var b: number;
var c: Object;
var d: Number;
// boolean + every type except any and string
var r1 = a + a;
var r2 = a + b;
var r3 = a + c;
// number + every type except any and string
var r4 = b + a;
var r5 = b + b; // number + number is valid
var r6 = b + c;
// object + every type except any and string
var r7 = c + a;
var r8 = c + b;
var r9 = c + c;
// other cases
var r10 = a + true;
var r11 = true + false;
var r12 = true + 123;
var r13 = {} + {};
var r14 = b + d;
var r15 = b + foo;
var r16 = b + foo();
var r17 = b + C;
var r18 = E.a + new C();
var r19 = E.a + C.foo();
var r20 = E.a + M; | 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.