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/checkJsdocSatisfiesTag5.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {{ move(distance: number): void }} Movable */ const car = /** @satisfies {Movable & Record<string, unknown>} */ ({ start() { }, move(d) { // d should be number }, stop() { } })
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag6.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} Point2d * @property {number} x * @property {number} y */ // Undesirable behavior today with type annotation const a = /** @satisfies {Partial<Point2d>} */ ({ x: 10 }); // Should OK console.log(a.x.toFixed()); // Sho...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag7.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {"a" | "b" | "c" | "d"} Keys */ const p = /** @satisfies {Record<Keys, unknown>} */ ({ a: 0, b: "hello", x: 8 // Should error, 'x' isn't in 'Keys' }) // Should be OK -- retain info that a is number and b is string let a...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag8.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** @typedef {Object.<string, boolean>} Facts */ // Should be able to detect a failure here const x = /** @satisfies {Facts} */ ({ m: true, s: "false" })
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocSatisfiesTag9.ts
TypeScript
// @noEmit: true // @allowJS: true // @checkJs: true // @filename: /a.js /** * @typedef {Object} Color * @property {number} r * @property {number} g * @property {number} b */ // All of these should be Colors, but I only use some of them here. export const Palette = /** @satisfies {Record<string, Color>} */ ({ ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag1.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** @type {String} */ var S = "hello world"; /** @type {number} */ var n = 10; /** @type {*} */ var anyT = 2; anyT = "hello"; /** @type {?} */ var anyT1 = 2; anyT1 = "hi"; /** @type {Function} */ const x = (a) => a + 1; x(1); /**...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag2.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** @type {String} */ var S = true; /** @type {number} */ var n = "hello"; /** @type {function (number)} */ const x1 = (a) => a + 1; x1("string"); /** @type {function (number): number} */ const x2 = (a) => a + 1; /** @type {string...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag3.ts
TypeScript
// @Filename:test.js // @checkJs: true // @allowJs: true // @noEmit: true /** @type {Array<?number>} */ var nns;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag4.ts
TypeScript
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: t.d.ts type A<T extends string> = { a: T } // @Filename: test.js /** Also should error for jsdoc typedefs * @template {string} U * @typedef {{ b: U }} B */ /** @type {A<number>} */ var a; /** @type {B<number>} */ var b;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag5.ts
TypeScript
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: test.js // all 6 should error on return statement/expression /** @type {(x: number) => string} */ function h(x) { return x } /** @type {(x: number) => string} */ var f = x => x /** @type {(x: number) => string} */ var g = function (x) { return x } /** ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag6.ts
TypeScript
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: test.js /** @type {number} */ function f() { return 1 } /** @type {{ prop: string }} */ var g = function (prop) { } /** @type {(a: number) => number} */ function add1(a, b) { return a + b; } /** @type {(a: number, b: number) => number} */ functi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTag7.ts
TypeScript
// @checkJs: true // @allowJs: true // @noEmit: true // @Filename: test.js /** * @typedef {(a: string, b: number) => void} Foo */ class C { /** @type {Foo} */ foo(a, b) {} /** @type {(optional?) => void} */ methodWithOptionalParameters() {} }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTagOnObjectProperty1.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @strictNullChecks: true // @filename: 0.js // @ts-check var lol = "hello Lol" const obj = { /** @type {string|undefined} */ foo: undefined, /** @type {string|undefined} */ bar: "42", /** @type {function(number): number} */ method1(n1) { return n1...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypeTagOnObjectProperty2.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @strictNullChecks: true // @filename: 0.js // @ts-check var lol; const obj = { /** @type {string|undefined} */ bar: 42, /** @type {function(number): number} */ method1(n1) { return "42"; }, /** @type {function(number): number} */ method2: (n1) ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypedefInParamTag1.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check /** * @typedef {Object} Opts * @property {string} x * @property {string=} y * @property {string} [z] * @property {string} [w="hi"] * * @param {Opts} opts */ function foo(opts) { opts.x; } foo({x: 'abc'}); /** * @typedef...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsdocTypedefOnlySourceFile.ts
TypeScript
// @allowJS: true // @suppressOutputPathCheck: true // @filename: 0.js // @ts-check var exports = {}; /** * @typedef {string} */ exports.SomeName; /** @type {exports.SomeName} */ const myString = 'str';
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenCanBeTupleType.tsx
TypeScript (TSX)
// @jsx: react // @strict: true // @esModuleInterop: true /// <reference path="/.lib/react16.d.ts" /> import React from 'react' interface ResizablePanelProps { children: [React.ReactNode, React.ReactNode] } class ResizablePanel extends React.Component< ResizablePanelProps, any> {} const test = <ResizablePanel> ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: string | JSX.Element } function Comp(p: Prop) { return <div>{p.b}</div>; } // OK let k = <Comp a={10} b=...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty10.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementAttributesProperty { props: {} } interface IntrinsicElements { div: any; h2: any; h1: any; } } class Button { props: {} render() { return (<div>My Button</div>) } } // OK let k1 = <div> <h2> ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty11.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve //@noImplicitAny: true declare module JSX { interface Element { } interface ElementAttributesProperty { props: {} } interface IntrinsicElements { div: any; h2: any; h1: any; } } class Button { props: {} render() { return (<div>My Button</div>) } } // ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty12.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ButtonProp { a: number, b: string, children: Button; } class Button extends React.Component<ButtonProp, any> { render() { let condition: boole...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty13.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @strictNullChecks: true import React = require('react'); interface ButtonProp { a: number, b: string, children: Button; } class Button extends React.Component<ButtonProp, any> { render...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty14.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: JSX.Element | JSX.Element[]; } class Button extends React.Component<any, any> { render() { return...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty15.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const Tag = (x: {}) => <div></div>; // OK const k1 = <Tag />; const k2 = <Tag></Tag>; // Not OK (excess children) const k3 = <Tag children={<div></div>} />; const k4 = <...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty16.tsx
TypeScript (TSX)
// @strict: true // @noEmit: true // @jsx: preserve /// <reference path="/.lib/react16.d.ts" /> // repro from #53493 import React = require('react'); export type Props = | { renderNumber?: false; children: (arg: string) => void } | { renderNumber: true; children: (arg: number) => void; }; expor...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts // @strictNullChecks: true import React = require('react'); interface Prop { a: number, b: string, children: string | JSX.Element } function Comp(p: Prop) { return <div>{p.b}</div>; } //...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface IUser { Name: string; } interface IFetchUserProps { children: (user: IUser) => JSX.Element; } class FetchUser extends React.Component<IFetchUserProps, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty4.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface IUser { Name: string; } interface IFetchUserProps { children: (user: IUser) => JSX.Element; } class FetchUser extends React.Component<IFetchUserProps, ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty5.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: Button; } class Button extends React.Component<any, any> { render() { return (<div>My Button</div...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty6.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: JSX.Element | JSX.Element[]; } class Button extends React.Component<any, any> { render() { return...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty7.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: JSX.Element | JSX.Element[]; } class Button extends React.Component<any, any> { render() { return...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty8.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface Prop { a: number, b: string, children: string | JSX.Element | (string | JSX.Element)[]; } class Button extends React.Component<any, any> { rende...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxChildrenProperty9.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); // OK let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>; let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>; let k3 = <div> {1} {"That is a n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxGenericTagHasCorrectInferences.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import * as React from "react"; interface BaseProps<T> { initialValues: T; nextValues: (cur: T) => T; } declare class GenericComponent<Props = {}, Values = object> extends React.Component<Props & BasePr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxIntersectionElementPropsType.tsx
TypeScript (TSX)
// @jsx: preserve // @strict: true declare namespace JSX { interface ElementAttributesProperty { props: {}; } } declare class Component<P> { constructor(props: Readonly<P>); readonly props: Readonly<P>; } class C<T> extends Component<{ x?: boolean; } & T> {} const y = new C({foobar: "example"}); const x = <C ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxSubtleSkipContextSensitiveBug.tsx
TypeScript (TSX)
// @strict: true // @jsx: react // @lib: es6 // @skipLibCheck: true /// <reference path="/.lib/react16.d.ts" /> import * as React from "react"; interface ErrorResult { error: true } interface AsyncLoaderProps<TResult> { readonly prop1: () => Promise<TResult>; readonly prop2: (result: Exclude<TResult, ErrorRe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkJsxUnionSFXContextualTypeInferredCorrectly.tsx
TypeScript (TSX)
// @jsx: react // @strict: true // @esModuleInterop: true /// <reference path="/.lib/react16.d.ts" /> import React from 'react'; interface PS { multi: false value: string | undefined onChange: (selection: string | undefined) => void } interface PM { multi: true value: string[] onChange: (sele...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkObjectDefineProperty.ts
TypeScript
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: index.js const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: true }); Object.defineProperty(x, "middleInit", { value: "H" }); Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); Object.def...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkOtherObjectAssignProperty.ts
TypeScript
// @allowJs: true // @noEmit: true // @strict: true // @checkJs: true // @filename: mod1.js const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); /** * @type {string} */ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/checkSpecialPropertyAssignments.ts
TypeScript
// @noEmit: true // @checkJs: true // @allowJs: true // @Filename: bug24252.js var A = {}; A.B = class { m() { /** @type {string[]} */ var x = []; /** @type {number[]} */ var y; y = x; } };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circular1.ts
TypeScript
// @noEmit: true // @Filename: /a.ts export type { A } from './b'; // @Filename: /b.ts export type { A } from './a';
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circular2.ts
TypeScript
// @noEmit: true // @Filename: /a.ts import type { B } from './b'; export type A = B; // @Filename: /b.ts import type { A } from './a'; export type B = A;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circular3.ts
TypeScript
// @noEmit: true // @Filename: /a.ts import type { A } from './b'; export type { A as B }; // @Filename: /b.ts import type { B } from './a'; export type { B as A };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circular4.ts
TypeScript
// @noEmit: true // @Filename: /a.ts import type { ns2 } from './b'; export namespace ns1 { export namespace nested { export type T = ns2.nested.T; } } // @Filename: /b.ts import type { ns1 } from './a'; export namespace ns2 { export namespace nested { export type T = ns1.nested.T; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularImportAlias.ts
TypeScript
// expected no error module B { export import a = A; export class D extends a.C { id: number; } } module A { export class C { name: string } export import b = B; } var c: { name: string }; var c = new B.a.C();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularIndexedAccessErrors.ts
TypeScript
// @declaration: true type T1 = { x: T1["x"]; // Error }; type T2<K extends "x" | "y"> = { x: T2<K>[K]; // Error y: number; } declare let x2: T2<"x">; let x2x = x2.x; interface T3<T extends T3<T>> { x: T["x"]; } interface T4<T extends T4<T>> { x: T4<T>["x"]; // Error } class C1 { x: C1[...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularMultipleAssignmentDeclaration.ts
TypeScript
// @filename:circularMultipleAssignmentDeclaration.js // @allowJs: true // @checkJs: true // @noEmit: true ns.next = ns.next || { shared: {} }; ns.next.shared.mymethod = {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularReference.ts
TypeScript
// @Filename: foo1.ts import foo2 = require('./foo2'); export module M1 { export class C1 { m1: foo2.M1.C1; x: number; constructor(){ this.m1 = new foo2.M1.C1(); this.m1.y = 10; // OK this.m1.x = 20; // Error } } } // @Filename: foo2.ts import foo1 = require('./foo1'); export module M1 { export cla...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularTypeAliasForUnionWithClass.ts
TypeScript
var v0: T0; type T0 = string | I0; class I0 { x: T0; } var v3: T3; type T3 = string | I3; class I3 { [x: number]: T3; } var v4: T4; type T4 = string | I4; class I4 { [x: string]: T4; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularTypeAliasForUnionWithInterface.ts
TypeScript
var v0: T0; type T0 = string | I0; interface I0 { x: T0; } var v1: T1; type T1 = string | I1; interface I1 { (): T1; } var v2: T2; type T2 = string | I2; interface I2 { new (): T2; } var v3: T3; type T3 = string | I3; interface I3 { [x: number]: T3; } var v4: T4; type T4 = string | I4; interface I4 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/circularTypeofWithVarOrFunc.ts
TypeScript
type typeAlias1 = typeof varOfAliasedType1; var varOfAliasedType1: typeAlias1; var varOfAliasedType2: typeAlias2; type typeAlias2 = typeof varOfAliasedType2; function func(): typeAlias3 { return null; } var varOfAliasedType3 = func(); type typeAlias3 = typeof varOfAliasedType3; // Repro from #26104 interface Input ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/cjsImportInES2015.ts
TypeScript
// @module: es2015 // @moduleResolution: node // @Filename: /project/node_modules/cjs-dep/index.d.ts declare class SpecialError extends Error {} export = SpecialError; // @Filename: /project/index.ts import type SpecialError = require("cjs-dep"); function handleError(err: SpecialError) {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractAsIdentifier.ts
TypeScript
class abstract { foo() { return 1; } } new abstract;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractAssignabilityConstructorFunction.ts
TypeScript
abstract class A { } // var AA: typeof A; var AAA: new() => A; // AA = A; // okay AAA = A; // error. AAA = "asdf";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractClinterfaceAssignability.ts
TypeScript
interface I { x: number; } interface IConstructor { new (): I; y: number; prototype: I; } var I: IConstructor; abstract class A { x: number; static y: number; } var AA: typeof A; AA = I; var AAA: typeof I; AAA = A;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractConstructorAssignability.ts
TypeScript
class A {} abstract class B extends A {} class C extends B {} var AA : typeof A = B; var BB : typeof B = A; var CC : typeof C = B; new AA; new BB; new CC;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractFactoryFunction.ts
TypeScript
class A {} abstract class B extends A {} function NewA(Factory: typeof A) { return new A; } function NewB(Factory: typeof B) { return new B; } NewA(A); NewA(B); NewB(A); NewB(B);
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractImportInstantiation.ts
TypeScript
module M { export abstract class A {} new A; } import myA = M.A; new myA;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractInAModule.ts
TypeScript
module M { export abstract class A {} export class B extends A {} } new M.A; new M.B;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractInstantiations1.ts
TypeScript
// // Calling new with (non)abstract classes. // abstract class A {} class B extends A {} abstract class C extends B {} new A; new A(1); // should report 1 error new B; new C; var a : A; var b : B; var c : C; a = new B; b = new B; c = new B;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractMergedDeclaration.ts
TypeScript
abstract class CM {} module CM {} module MC {} abstract class MC {} abstract class CI {} interface CI {} interface IC {} abstract class IC {} abstract class CC1 {} class CC1 {} class CC2 {} abstract class CC2 {} declare abstract class DCI {} interface DCI {} interface DIC {} declare abstract class DIC {} declar...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractOverloads.ts
TypeScript
abstract class A { abstract foo(); abstract foo() : number; abstract foo(); abstract bar(); bar(); abstract bar(); abstract baz(); baz(); abstract baz(); baz() {} qux(); } abstract class B { abstract foo() : number; abstract foo(); x : number; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractSingleLineDecl.ts
TypeScript
abstract class A {} abstract class B {} abstract class C {} new A; new B; new C;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractSuperCalls.ts
TypeScript
class A { foo() { return 1; } } abstract class B extends A { abstract foo(); bar() { super.foo(); } baz() { return this.foo; } } class C extends B { foo() { return 2; } qux() { return super.foo() || super.foo; } // 2 errors, foo is abstract norf() { return super.bar(); } } class AA { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAbstractUsingAbstractMethod1.ts
TypeScript
abstract class A { abstract foo() : number; } class B extends A { foo() { return 1; } } abstract class C extends A { abstract foo() : number; } var a = new B; a.foo(); a = new C; // error, cannot instantiate abstract class. a.foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAndInterfaceMerge.d.ts
TypeScript
interface C { } declare class C { } interface C { } interface C { } declare module M { interface C1 { } class C1 { } interface C1 { } interface C1 { } export class C2 { } } declare module M { export interface C2 { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAndInterfaceMergeConflictingMembers.ts
TypeScript
declare class C1 { public x : number; } interface C1 { x : number; } declare class C2 { protected x : number; } interface C2 { x : number; } declare class C3 { private x : number; } interface C3 { x : number; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAndInterfaceWithSameName.ts
TypeScript
class C { foo: string; } interface C { foo: string; } module M { class D { bar: string; } interface D { bar: string; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAndVariableWithSameName.ts
TypeScript
class C { foo: string; } // error var C = ''; // error module M { class D { // error bar: string; } var D = 1; // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classAppearsToHaveMembersOfObject.ts
TypeScript
class C { foo: string; } var c: C; var r = c.toString(); var r2 = c.hasOwnProperty(''); var o: Object = c; var o2: {} = c;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classCanExtendConstructorFunction.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: first.js /** * @constructor * @param {number} numberOxen */ function Wagon(numberOxen) { this.numberOxen = numberOxen } /** @param {Wagon[]=} wagons */ Wagon.circle = function (wagons) { return wagons ? wagons.length : 3.14; } /** @param {*[]...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorAccessibility.ts
TypeScript
// @declaration: true class C { public constructor(public x: number) { } } class D { private constructor(public x: number) { } } class E { protected constructor(public x: number) { } } var c = new C(1); var d = new D(1); // error var e = new E(1); // error module Generic { class C<T> { publ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorAccessibility2.ts
TypeScript
// @declaration: true class BaseA { public constructor(public x: number) { } createInstance() { new BaseA(1); } } class BaseB { protected constructor(public x: number) { } createInstance() { new BaseB(2); } } class BaseC { private constructor(public x: number) { } createInstance() { new BaseC...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorAccessibility3.ts
TypeScript
// @declaration: true class Foo { constructor(public x: number) { } } class Bar { public constructor(public x: number) { } } class Baz { protected constructor(public x: number) { } } class Qux { private constructor(public x: number) { } } // b is public let a = Foo; a = Bar; a = Baz; // error Baz...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorAccessibility4.ts
TypeScript
// @declaration: true class A { private constructor() { } method() { class B { method() { new A(); // OK } } class C extends A { // OK } } } class D { protected constructor() { } method() { class E { met...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorAccessibility5.ts
TypeScript
class Base { protected constructor() { } } class Derived extends Base { static make() { new Base() } // ok } class Unrelated { static fake() { new Base() } // error }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorOverloadsAccessibility.ts
TypeScript
// @declaration: true class A { public constructor(a: boolean) // error protected constructor(a: number) // error private constructor(a: string) private constructor() { } } class B { protected constructor(a: number) // error constructor(a: string) constructor() { } } class C { protected constructor...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorParametersAccessibility.ts
TypeScript
class C1 { constructor(public x: number) { } } var c1: C1; c1.x // OK class C2 { constructor(private p: number) { } } var c2: C2; c2.p // private, error class C3 { constructor(protected p: number) { } } var c3: C3; c3.p // protected, error class Derived extends C3 { constructor(p: number) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorParametersAccessibility2.ts
TypeScript
class C1 { constructor(public x?: number) { } } var c1: C1; c1.x // OK class C2 { constructor(private p?: number) { } } var c2: C2; c2.p // private, error class C3 { constructor(protected p?: number) { } } var c3: C3; c3.p // protected, error class Derived extends C3 { constructor(p: number) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classConstructorParametersAccessibility3.ts
TypeScript
class Base { constructor(protected p: number) { } } class Derived extends Base { constructor(public p: number) { super(p); this.p; // OK } } var d: Derived; d.p; // public, OK
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classDeclarationLoop.ts
TypeScript
const arr = []; for (let i = 0; i < 10; ++i) { class C { prop = i; } arr.push(C); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classDoesNotDependOnBaseTypes.ts
TypeScript
type StringTree = string | StringTreeCollection; class StringTreeCollectionBase { [n: number]: StringTree; } class StringTreeCollection extends StringTreeCollectionBase { } var x: StringTree; if (typeof x !== "string") { x[0] = ""; x[0] = new StringTreeCollection; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classDoesNotDependOnPrivateMember.ts
TypeScript
//@declaration: true module M { interface I { } export class C { private x: I; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression.ts
TypeScript
var x = class C { } var y = { foo: class C2 { } } module M { var z = class C4 { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression1.ts
TypeScript
var v = class C {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression2.ts
TypeScript
class D { } var v = class C extends D {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression3.ts
TypeScript
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; let c = new C(); c.a; c.b; c.c;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression4.ts
TypeScript
let C = class { foo() { return new C(); } }; let x = (new C).foo();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpression5.ts
TypeScript
new class { hi() { return "Hi!"; } }().hi();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpressionES61.ts
TypeScript
// @target: es6 var v = class C {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpressionES62.ts
TypeScript
// @target: es6 class D { } var v = class C extends D {};
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpressionES63.ts
TypeScript
// @target: es6 let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 }; let c = new C(); c.a; c.b; c.c;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExpressionLoop.ts
TypeScript
let arr = []; for (let i = 0; i < 10; ++i) { arr.push(class C { prop = i; }); }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingBuiltinType.ts
TypeScript
class C1 extends Object { } class C2 extends Function { } class C3 extends String { } class C4 extends Boolean { } class C5 extends Number { } class C6 extends Date { } class C7 extends RegExp { } class C8 extends Error { } class C9 extends Array { } class C10 extends Array<number> { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingClass.ts
TypeScript
class C { foo: string; thing() { } static other() { } } class D extends C { bar: string; } var d: D; var r = d.foo; var r2 = d.bar; var r3 = d.thing(); var r4 = D.other(); class C2<T> { foo: T; thing(x: T) { } static other<T>(x: T) { } } class D2<T> extends C2<T> { bar: string; } va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingClassLikeType.ts
TypeScript
interface Base<T, U> { x: T; y: U; } // Error, no Base constructor function class D0 extends Base<string, string> { } interface BaseConstructor { new (x: string, y: string): Base<string, string>; new <T>(x: T): Base<T, T>; new <T>(x: T, y: T): Base<T, T>; new <T, U>(x: T, y: U): Base<T, U>; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingNonConstructor.ts
TypeScript
var x: {}; function foo() { this.x = 1; } class C1 extends undefined { } class C2 extends true { } class C3 extends false { } class C4 extends 42 { } class C5 extends "hello" { } class C6 extends x { } class C7 extends foo { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingNull.ts
TypeScript
class C1 extends null { } class C2 extends (null) { } class C3 extends null { x = 1; } class C4 extends (null) { x = 1; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendingOptionalChain.ts
TypeScript
namespace A { export class B {} } // ok class C1 extends A?.B {} // error class C2 implements A?.B {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/classExtendsItself.ts
TypeScript
class C extends C { } // error class D<T> extends D<T> { } // error class E<T> extends E<string> { } // error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University