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/additionOperatorWithNullValueAndInvalidOperator.ts
TypeScript
// If one operand is the null or undefined value, it is treated as having the type of the other operand. function foo(): void { return undefined } var a: boolean; var b: Object; var c: void; var d: Number; // null + boolean/Object var r1 = null + a; var r2 = null + b; var r3 = null + c; var r4 = a + null; var r5 = b...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithNullValueAndValidOperator.ts
TypeScript
// If one operand is the null or undefined value, it is treated as having the type of the other operand. enum E { a, b, c } var a: any; var b: number; var c: E; var d: string; // null + any var r1: any = null + a; var r2: any = a + null; // null + number/enum var r3 = null + b; var r4 = null + 1; var r5 = null + c;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithNumberAndEnum.ts
TypeScript
enum E { a, b } enum F { c, d } var a: number; var b: E; var c: E | F; var r1 = a + a; var r2 = a + b; var r3 = b + a; var r4 = b + b; var r5 = 0 + a; var r6 = E.a + 0; var r7 = E.a + E.b; var r8 = E['a'] + E['b']; var r9 = E['a'] + F['c']; var r10 = a + c; var r11 = c + a; var r12 = b + c; var r13 = c + b; var r14...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithOnlyNullValueOrUndefinedValue.ts
TypeScript
// bug 819721 var r1 = null + null; var r2 = null + undefined; var r3 = undefined + null; var r4 = undefined + undefined;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithStringAndEveryType.ts
TypeScript
enum E { a, b, c } var a: any; var b: boolean; var c: number; var d: string; var e: Object; var f: void; var g: E; var x: string; // string could plus every type, and the result is always string // string as left operand var r1 = x + a; var r2 = x + b; var r3 = x + c; var r4 = x + d; var r5 = x + e; var r6 = x + f; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithTypeParameter.ts
TypeScript
// type parameter type is not a valid operand of addition operator enum E { a, b } function foo<T, U>(t: T, u: U) { var a: any; var b: boolean; var c: number; var d: string; var e: Object; var g: E; var f: void; // type parameter as left operand var r1: any = t + a; // ok, one oper...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithUndefinedValueAndInvalidOperands.ts
TypeScript
// If one operand is the null or undefined value, it is treated as having the type of the other operand. function foo(): void { return undefined } var a: boolean; var b: Object; var c: void; var d: Number; // undefined + boolean/Object var r1 = undefined + a; var r2 = undefined + b; var r3 = undefined + c; var r4 = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/additionOperatorWithUndefinedValueAndValidOperator.ts
TypeScript
// If one operand is the null or undefined value, it is treated as having the type of the other operand. enum E { a, b, c } var a: any; var b: number; var c: E; var d: string; // undefined + any var r1: any = undefined + a; var r2: any = a + undefined; // undefined + number/enum var r3 = undefined + b; var r4 = und...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/allowImportingTsExtensions.ts
TypeScript
// @allowImportingTsExtensions: true // @noEmit: true // @moduleResolution: classic,node10,node16,nodenext,bundler // @jsx: preserve // @noTypesAndSymbols: true // @Filename: /ts.ts export {}; // @Filename: /tsx.tsx export {}; // @Filename: /dts.d.ts export {}; // @Filename: /b.ts import {} from "./ts.js"; import {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/allowImportingTypesDtsExtension.ts
TypeScript
// @allowImportingTsExtensions: true,false // @noEmit: true // @moduleResolution: classic,node10,node16,nodenext // @noTypesAndSymbols: true // @Filename: /types.d.ts export declare type User = { name: string; } // @Filename: /a.ts import type { User } from "./types.d.ts"; export type { User } from "./types.d.ts"...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/allowUnescapedParagraphAndLineSeparatorsInStringLiteral.ts
TypeScript
// Strings containing unescaped line / paragraph separators // Using both single quotes, double quotes and template literals var stringContainingUnescapedLineSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedParagraphSeparator1 = "
STRING_CONTENT
"; var stringContainingUnescapedLineSeparator2 = '
STRING_...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/allowsImportingTsExtension.ts
TypeScript
// @allowImportingTsExtensions: false // @target: esnext // @module: esnext // @Filename: a.ts export class A {} // @Filename: a.d.ts export class A {} // @Filename: b.ts import type { A } from "./a.ts"; // ok import {} from "./a.ts"; // error import { type A as _A } from "./a.ts"; // error type __A = import("./a.ts...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambient.ts
TypeScript
// @Filename: /a.ts export class A { a!: string } // @Filename: /b.ts import type { A } from './a'; declare class B extends A {} declare namespace ns { class C extends A {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientAccessors.ts
TypeScript
// @target: es5 // @declaration: true // ok to use accessors in ambient class in ES3 declare class C { static get a(): string; static set a(value: string); private static get b(): string; private static set b(foo: string); get x(): string; set x(value: string); private get y(): string; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarations.ts
TypeScript
// Ambient variable without type annotation declare var n; // Ambient variable with type annotation declare var m: string; // Ambient function with no type annotations declare function fn1(); // Ambient function with type annotations declare function fn2(n: string): number; // Ambient function with valid overloads ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsExternal.ts
TypeScript
//@Filename: decls.ts // Ambient external module with export assignment declare module 'equ' { var x; export = x; } declare module 'equ2' { var x: number; } // Ambient external import declaration referencing ambient external module using top level module name //@Filename: consumer.ts /// <reference path=...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsPatterns.ts
TypeScript
// @Filename: declarations.d.ts declare module "foo*baz" { export function foo(s: string): void; } // Augmentations still work declare module "foo*baz" { export const baz: string; } // Longest prefix wins declare module "foos*" { export const foos: string; } declare module "*!text" { const x: string; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsPatterns_merging1.ts
TypeScript
// @filename: types.ts declare module "*.foo" { let everywhere: string; } // @filename: testA.ts import { everywhere, onlyInA } from "a.foo"; declare module "a.foo" { let onlyInA: number; } // @filename: testB.ts import { everywhere, onlyInA } from "b.foo"; // Error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsPatterns_merging2.ts
TypeScript
// @filename: types.ts declare module "*.foo" { let everywhere: string; } // @filename: testA.ts import { everywhere, onlyInA, alsoOnlyInA } from "a.foo"; declare module "a.foo" { let onlyInA: number; } // @filename: testB.ts import { everywhere, onlyInA, alsoOnlyInA } from "b.foo"; // Error declare module "a.fo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsPatterns_merging3.ts
TypeScript
// @filename: types.ts declare module "*.foo" { export interface OhNo { star: string } } // @filename: test.ts declare module "a.foo" { export interface OhNo { a: string } } import { OhNo } from "b.foo" declare let ohno: OhNo; ohno.a // oh no
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientDeclarationsPatterns_tooManyAsterisks.ts
TypeScript
declare module "too*many*asterisks" { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientEnumDeclaration1.ts
TypeScript
// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. declare enum E { a = 10, b = 10 + 1, c = b, d = (c) + 1, e = 10 << 2 * 8, }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientEnumDeclaration2.ts
TypeScript
// In ambient enum declarations that specify no const modifier, enum member declarations // that omit a value are considered computed members (as opposed to having auto- incremented values assigned). declare enum E { a, // E.a b, // E.b } declare const enum E1 { a, // E.a = 0 b, // E.b = 1 }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientExternalModuleInsideNonAmbient.ts
TypeScript
module M { export declare module "M" { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientExternalModuleInsideNonAmbientExternalModule.ts
TypeScript
//@module: amd export declare module "M" { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientExternalModuleMerging.ts
TypeScript
//@filename: ambientExternalModuleMerging_use.ts //@module: amd import M = require("M"); // Should be strings var x = M.x; var y = M.y; //@filename: ambientExternalModuleMerging_declare.ts declare module "M" { export var x: string; } // Merge declare module "M" { export var y: string; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientInsideNonAmbient.ts
TypeScript
module M { export declare var x; export declare function f(); export declare class C { } export declare enum E { } export declare module M { } } module M2 { declare var x; declare function f(); declare class C { } declare enum E { } declare module M { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientInsideNonAmbientExternalModule.ts
TypeScript
// @module: amd export declare var x; export declare function f(); export declare class C { } export declare enum E { } export declare module M { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientShorthand.ts
TypeScript
// @Filename: declarations.d.ts declare module "jquery" // Semicolon is optional declare module "fs"; // @Filename: user.ts ///<reference path="declarations.d.ts"/> import foo, {bar} from "jquery"; import * as baz from "fs"; import boom = require("jquery"); foo(bar, baz, boom);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientShorthand_declarationEmit.ts
TypeScript
// @declaration: true declare module "foo";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientShorthand_duplicate.ts
TypeScript
// @Filename: declarations1.d.ts declare module "foo"; // @Filename: declarations2.d.ts declare module "foo"; // @Filename: user.ts ///<reference path="declarations1.d.ts" /> ///<reference path="declarations1.d.ts" /> import foo from "foo";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientShorthand_merging.ts
TypeScript
// @Filename: declarations1.d.ts declare module "foo"; // @Filename: declarations2.d.ts declare module "foo" { export const bar: number; } // @Filename: user.ts ///<reference path="declarations1.d.ts" /> ///<reference path="declarations1.d.ts" /> import foo, {bar} from "foo";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/ambientShorthand_reExport.ts
TypeScript
// @Filename: declarations.d.ts declare module "jquery"; // @Filename: reExportX.ts export {x} from "jquery"; // @Filename: reExportAll.ts export * from "jquery"; // @Filename: reExportUser.ts import {x} from "./reExportX"; import * as $ from "./reExportAll"; // '$' is not callable, it is an object. x($);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/amdImportAsPrimaryExpression.ts
TypeScript
// @module: amd // @Filename: foo_0.ts export enum E1 { A,B,C } // @Filename: foo_1.ts import foo = require("./foo_0"); if(foo.E1.A === 0){ // Should cause runtime import - interesting optimization possibility, as gets inlined to 0. }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/amdImportNotAsPrimaryExpression.ts
TypeScript
// @module: amd // @Filename: foo_0.ts export class C1 { m1 = 42; static s1 = true; } export interface I1 { name: string; age: number; } export module M1 { export interface I2 { foo: string; } } export enum E1 { A,B,C } // @Filename: foo_1.ts import foo = require("./foo_0"); // None of the below should cau...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/annotatedThisPropertyInitializerDoesntNarrow.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: Compilation.js // from webpack/lib/Compilation.js and filed at #26427 /** @param {{ [s: string]: number }} map */ function mappy(map) {} export class C { constructor() { /** @type {{ [assetName: string]: number}} */ this.assets = {}...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anonymousDefaultExportsAmd.ts
TypeScript
// @target: ES6 // @module: amd // @filename: a.ts export default class {} // @filename: b.ts export default function() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anonymousDefaultExportsCommonjs.ts
TypeScript
// @target: ES6 // @module: commonjs // @filename: a.ts export default class {} // @filename: b.ts export default function() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anonymousDefaultExportsSystem.ts
TypeScript
// @target: ES6 // @module: system // @filename: a.ts export default class {} // @filename: b.ts export default function() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anonymousDefaultExportsUmd.ts
TypeScript
// @target: ES6 // @module: umd // @filename: a.ts export default class {} // @filename: b.ts export default function() {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAsConstructor.ts
TypeScript
// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; var a = new x(); var b = new x('hello'); var c = new x(x); // grammar allows this for constructors var d = new x<any>(x); // no error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAsFunctionCall.ts
TypeScript
// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; var a = x(); var b = x('hello'); var c = x(x);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAsGenericFunctionCall.ts
TypeScript
// any is considered an untyped function call // can be called except with type arguments which is an error var x: any; var a = x<number>(); var b = x<string>('hello'); class C { foo: string; } var c = x<C>(x); var d = x<any>(x);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAssignabilityInInheritance.ts
TypeScript
// any is not a subtype of any other types, errors expected on all the below derived classes unless otherwise noted interface I { [x: string]: any; foo: any; // ok, any identical to itself } var a: any; declare function foo2(x: number): number; declare function foo2(x: any): any; var r3 = foo2(a); // any, no...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAssignableToEveryType.ts
TypeScript
var a: any; class C { foo: string; } var ac: C; interface I { foo: string; } var ai: I; enum E { A } var ae: E; var b: number = a; var c: string = a; var d: boolean = a; var e: Date = a; var f: any = a; var g: void = a; var h: Object = a; var i: {} = a; var j: () => {} = a; var k: Function = a; var l: (x: nu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyAssignableToEveryType2.ts
TypeScript
// any is not a subtype of any other types, but is assignable, all the below should work interface I { [x: string]: any; foo: any; // ok, any identical to itself } interface I2 { [x: string]: number; foo: any; } interface I3 { [x: string]: string; foo: any; } interface I4 { [x: string...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/anyPropertyAccess.ts
TypeScript
var x: any; var a = x.foo; var b = x['foo']; var c = x['fn'](); var d = x.bar.baz; var e = x[0].foo; var f = x['0'].bar;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/apparentTypeSubtyping.ts
TypeScript
// subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: class Base<U extends String> { x: U; } // is String (S) a subtype of U extends String (T)? Would only be tr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/apparentTypeSupertype.ts
TypeScript
// subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: class Base { x: string; } // is String (S) a subtype of U extends String (T)? Would only be true if we used...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/argumentExpressionContextualTyping.ts
TypeScript
// In a typed function call, argument expressions are contextually typed by their corresponding parameter types. function foo({x: [a, b], y: {c, d, e}}) { } function bar({x: [a, b = 10], y: {c, d, e = { f:1 }}}) { } function baz(x: [string, number, boolean]) { } var o = { x: ["string", 1], y: { c: true, d: "world", e...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arithmeticOperatorWithAnyAndNumber.ts
TypeScript
var a: any; var b: number; // operator * var ra1 = a * a; var ra2 = a * b; var ra3 = a * 0; var ra4 = 0 * a; var ra5 = 0 * 0; var ra6 = b * 0; var ra7 = 0 * b; var ra8 = b * b; // operator / var rb1 = a / a; var rb2 = a / b; var rb3 = a / 0; var rb4 = 0 / a; var rb5 = 0 / 0; var rb6 = b / 0; var rb7 = 0 / b; var rb8 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arithmeticOperatorWithEnum.ts
TypeScript
// operands of an enum type are treated as having the primitive type Number. enum E { a, b } var a: any; var b: number; var c: E; // operator * var ra1 = c * a; var ra2 = c * b; var ra3 = c * c; var ra4 = a * c; var ra5 = b * c; var ra6 = E.a * a; var ra7 = E.a * b; var ra8 = E.a * E.b; var ra9 = E.a * 1; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arithmeticOperatorWithEnumUnion.ts
TypeScript
// operands of an enum type are treated as having the primitive type Number. enum E { a, b } enum F { c, d } var a: any; var b: number; var c: E | F; // operator * var ra1 = c * a; var ra2 = c * b; var ra3 = c * c; var ra4 = a * c; var ra5 = b * c; var ra6 = E.a * a; var ra7 = E.a * b; var ra8 = E.a ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arithmeticOperatorWithInvalidOperands.ts
TypeScript
// these operators require their operands to be of type Any, the Number primitive type, or // an enum type enum E { a, b, c } var a: any; var b: boolean; var c: number; var d: string; var e: { a: number }; var f: Number; // All of the below should be an error unless otherwise noted // operator * var r1a1 = a * a; //o...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arithmeticOperatorWithTypeParameter.ts
TypeScript
// type parameter type is not valid for arithmetic operand function foo<T>(t: T) { var a: any; var b: boolean; var c: number; var d: string; var e: {}; var r1a1 = a * t; var r1a2 = a / t; var r1a3 = a % t; var r1a4 = a - t; var r1a5 = a << t; var r1a6 = a >> t; var r1a7 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arityAndOrderCompatibility01.ts
TypeScript
interface StrNum extends Array<string|number> { 0: string; 1: number; length: 2; } var x: [string, number]; var y: StrNum var z: { 0: string; 1: number; length: 2; } var [a, b, c] = x; var [d, e, f] = y; var [g, h, i] = z; var j1: [number, number, number] = x; var j2: [number, number, number] ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayAssignmentPatternWithAny.ts
TypeScript
var a: any; var x: string; [x] = a;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteral.ts
TypeScript
// valid uses of array literals var x = []; var x = new Array(1); var y = [1]; var y = [1, 2]; var y = new Array<number>(); var x2: number[] = []; var x2: number[] = new Array(1); var y2: number[] = [1]; var y2: number[] = [1, 2]; var y2: number[] = new Array<number>();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralExpressionContextualTyping.ts
TypeScript
// In a contextually typed array literal expression containing no spread elements, an element expression at index N is contextually typed by // the type of the property with the numeric name N in the contextual type, if any, or otherwise // the numeric index type of the contextual type, if any. var array = [...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralInference.ts
TypeScript
// @strict: true // @target: es2015 // Repro from #31204 export enum AppType { HeaderDetail = 'HeaderDetail', HeaderMultiDetail = 'HeaderMultiDetail', AdvancedList = 'AdvancedList', Standard = 'Standard', Relationship = 'Relationship', Report = 'Report', Composite = 'Composite', ListOn...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralSpread.ts
TypeScript
function f0() { var a = [1, 2, 3]; var a1 = [...a]; var a2 = [1, ...a]; var a3 = [1, 2, ...a]; var a4 = [...a, 1]; var a5 = [...a, 1, 2]; var a6 = [1, 2, ...a, 1, 2]; var a7 = [1, ...a, 2, ...a]; var a8 = [...a, ...a, ...a]; } function f1() { var a = [1, 2, 3]; var b = ["hel...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralSpreadES5iterable.ts
TypeScript
// @downlevelIteration: true function f0() { var a = [1, 2, 3]; var a1 = [...a]; var a2 = [1, ...a]; var a3 = [1, 2, ...a]; var a4 = [...a, 1]; var a5 = [...a, 1, 2]; var a6 = [1, 2, ...a, 1, 2]; var a7 = [1, ...a, 2, ...a]; var a8 = [...a, ...a, ...a]; } function f1() { var a =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralWidened.ts
TypeScript
// array literals are widened upon assignment according to their element type var a = []; // any[] var a = [,,]; var a = [null, null]; var a = [undefined, undefined]; var b = [[], [null, null]]; // any[][] var b = [[], []]; var b = [[undefined, undefined]]; var c = [[[]]]; // any[][][] var c = [[[null]],[undefined]...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralWithMultipleBestCommonTypes.ts
TypeScript
// when multiple best common types exist we will choose the first candidate var a: { x: number; y?: number }; var b: { x: number; z?: number }; var c: { x: number; a?: number }; var as = [a, b]; // { x: number; y?: number };[] var bs = [b, a]; // { x: number; z?: number };[] var cs = [a, b, c]; // { x: number; y?: nu...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiterals.ts
TypeScript
// Empty array literal with no contextual type has type Undefined[] var arr1= [[], [1], ['']]; var arr2 = [[null], [1], ['']]; // Array literal with elements of only EveryType E has type E[] var stringArrArr = [[''], [""]]; var stringArr = ['', ""]; var numberArr = [0, 0.0, 0x00, 1e1]; var boolArr = [false, true...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiterals2ES5.ts
TypeScript
// ElementList: ( Modified ) // Elisionopt AssignmentExpression // Elisionopt SpreadElement // ElementList, Elisionopt AssignmentExpression // ElementList, Elisionopt SpreadElement // SpreadElement: // ... AssignmentExpression var a0 = [,, 2, 3, 4] var a1 = ["hello", "world"] var ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiterals2ES6.ts
TypeScript
// @target:es6 // ElementList: ( Modified ) // Elisionopt AssignmentExpression // Elisionopt SpreadElement // ElementList, Elisionopt AssignmentExpression // ElementList, Elisionopt SpreadElement // SpreadElement: // ... AssignmentExpression var a0 = [, , 2, 3, 4] var a1 = ["hello...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiterals3.ts
TypeScript
// Each element expression in a non-empty array literal is processed as follows: // - If the array literal contains no spread elements, and if the array literal is contextually typed (section 4.19) // by a type T and T has a property with the numeric name N, where N is the index of the element expression in th...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayLiteralsWithRecursiveGenerics.ts
TypeScript
class List<T> { data: T; next: List<List<T>>; } class DerivedList<U> extends List<U> { foo: U; // next: List<List<U>> } class MyList<T> { data: T; next: MyList<MyList<T>>; } var list: List<number>; var list2: List<string>; var myList: MyList<number>; var xs = [list, myList]; // {}[] var ys =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayOfFunctionTypes3.ts
TypeScript
// valid uses of arrays of function types var x = [() => 1, () => { }]; var r2 = x[0](); class C { foo: string; } var y = [C, C]; var r3 = new y[0](); var a: { (x: number): number; (x: string): string; }; var b: { (x: number): number; (x: string): string; }; var c: { (x: number): number; (x: any): any; }; var z ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arraySpreadImportHelpers.ts
TypeScript
// @target: es5 // @importHelpers: true // @isolatedModules: true // @noTypesAndSymbols: true // @noEmit: true // @filename: main.ts export {}; const k = [1, , 2]; const o = [3, ...k, 4]; // @filename: tslib.d.ts // this is a pre-TS4.4 versions of emit helper, which always forced array packing declare module "tslib" ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arraySpreadInCall.ts
TypeScript
// @strict: true // @noEmit: true declare function f1(a: number, b: number, c: number, d: number, e: number, f: number): void; f1(1, 2, 3, 4, ...[5, 6]); f1(...[1], 2, 3, 4, 5, 6); f1(1, 2, ...[3, 4], 5, 6); f1(1, 2, ...[3], 4, ...[5, 6]); f1(...[1, 2], ...[3, 4], ...[5, 6]); f1(...(([1, 2])), ...(((([3, 4])))), ...([...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayTypeOfFunctionTypes.ts
TypeScript
// valid uses of arrays of function types var x: () => string[]; var r = x[1]; var r2 = r(); var r2b = new r(); var x2: { (): string }[]; var r3 = x2[1]; var r4 = r3(); var r4b = new r3(); // error var x3: Array<() => string>; var r5 = x2[1]; var r6 = r5(); var r6b = new r5(); // error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayTypeOfFunctionTypes2.ts
TypeScript
// valid uses of arrays of function types var x: new () => string[]; var r = x[1]; var r2 = new r(); var r2b = r(); var x2: { new(): string }[]; var r3 = x[1]; var r4 = new r3(); var r4b = new r3(); var x3: Array<new () => string>; var r5 = x2[1]; var r6 = new r5(); var r6b = r5();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrayTypeOfTypeOf.ts
TypeScript
// array type cannot use typeof. var x = 1; var xs: typeof x[]; // Not an error. This is equivalent to Array<typeof x> var xs2: typeof Array; var xs3: typeof Array<number>; var xs4: typeof Array<typeof x>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrowFunctionExpressions.ts
TypeScript
// ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = (p: string) => p.length; var a = (p: string) => { return p.length; } // Identifier => Block is equivalent to(Identifier) => Block var b = j => { return 0; } var b = (j) => { return 0; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrowFunctionWithParameterNameAsync_es2017.ts
TypeScript
// @target: ES5 // @noEmitHelpers: true const x = async => async;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrowFunctionWithParameterNameAsync_es5.ts
TypeScript
// @target: ES5 // @lib: es5,es2015.promise // @noEmitHelpers: true const x = async => async;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/arrowFunctionWithParameterNameAsync_es6.ts
TypeScript
// @target: ES5 // @noEmitHelpers: true const x = async => async;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOpEmitParens.ts
TypeScript
declare var x; // Must emit as (x + 1) * 3 (x + 1 as number) * 3; // Should still emit as x.y (x as any).y; // Emit as new (x()) new (x() as any);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperator1.ts
TypeScript
var as = 43; var x = undefined as number; var y = (null as string).length; var z = Date as any as string; // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; j = '';
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperator2.ts
TypeScript
var x = 23 as string;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperator3.ts
TypeScript
declare function tag(...x: any[]): any; var a = `${123 + 456 as number}`; var b = `leading ${123 + 456 as number}`; var c = `${123 + 456 as number} trailing`; var d = `Hello ${123} World` as string; var e = `Hello` as string; var f = 1 + `${1} end of string` as string; var g = tag `Hello ${123} World` as string; var h...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperator4.ts
TypeScript
//@module: commonjs //@filename: foo.ts export function foo() { } //@filename: bar.ts import { foo } from './foo'; // These should emit identically <any>foo; (foo as any);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperatorASI.ts
TypeScript
class Foo { } declare function as(...args: any[]); // Example 1 var x = 10 as `Hello world`; // should not error // Example 2 var y = 20 as(Foo); // should emit
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperatorAmbiguity.ts
TypeScript
interface A<T> { x: T; } interface B { m: string; } // Make sure this is a type assertion to an array type, and not nested comparison operators. var x: any; var y = x as A<B>[]; var z = y[0].m; // z should be string
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperatorContextualType.ts
TypeScript
// should error var x = (v => v) as (x: number) => string;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asOperatorNames.ts
TypeScript
var a = 20; var b = a as string; var as = "hello"; var as1 = as as string;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsAmbientExternalModule01.ts
TypeScript
var declare: number; var module: string; declare // this is the identifier 'declare' module // this is the identifier 'module' "my external module" // this is just a string { } // this is a block body
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsAmbientExternalModule02.ts
TypeScript
var declare: number; var module: string; module container { declare // this is the identifier 'declare' module // this is the identifier 'module' "my external module" // this is just a string { } // this is a block body }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsInterface01.ts
TypeScript
var interface: number, I: string; interface // This should be the identifier 'interface' I // This should be the identifier 'I' {} // This should be a block body
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsInterface02.ts
TypeScript
function f(interface: number, I: string) { interface // This should be the identifier 'interface' I // This should be the identifier 'I' {} // This should be a block body }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsInterface03.ts
TypeScript
var interface: number, I: string; namespace n { interface // This should be the identifier 'interface' I // This should be the identifier 'I' {} // This should be a block body }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsInterface04.ts
TypeScript
var declare: boolean, interface: number, I: string; declare // This should be the identifier 'declare' interface // This should be the identifier 'interface' I // This should be the identifier 'I' {} // This should be a block body
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsNamespace01.ts
TypeScript
var namespace: number; var n: string; namespace // this is the identifier 'namespace' n // this is the identifier 'n' { } // this is a block body
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsNamespace02.ts
TypeScript
var module: number; var m: string; module // this is the identifier 'namespace' m // this is the identifier 'm' { } // this is a block body
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsNamespace03.ts
TypeScript
var namespace: number; var n: string; namespace container { namespace // this is the identifier 'namespace' n // this is the identifier 'n' { } // this is a block body }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsNamespace04.ts
TypeScript
let module = 10; module in {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsNamespace05.ts
TypeScript
let namespace = 10; namespace a.b { export let c = 20; } namespace a.b.c { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/asiPreventsParsingAsTypeAlias01.ts
TypeScript
var type; var string; var Foo; type Foo = string;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University