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/tsxStatelessFunctionComponents2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function Greet(x: {name?: string}) { return <div>Hello, {x}</div>; } class BigGreeter extends React.Component<{ name?: string }, {}> { render() { return <div></div>; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponents3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const Foo = (props: any) => <div/>; // Should be OK const foo = <Foo />; // Should be OK var MainMenu: React.StatelessComponent<{}> = (props) => (<div> ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentsWithTypeArguments1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react') declare function ComponentWithTwoAttributes<K,V>(l: {key1: K, value: V}): JSX.Element; // OK function Baz<T,U>(key1: T, value: U) { let a0 = <Component...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentsWithTypeArguments2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react') declare function ComponentSpecific1<U>(l: {prop: U, "ignore-prop": string}): JSX.Element; declare function ComponentSpecific2<U>(l: {prop: U}): JSX.Element;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentsWithTypeArguments3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react') declare function OverloadComponent<U>(): JSX.Element; declare function OverloadComponent<U>(attr: {b: U, a?: string, "ignore-prop": boolean}): JSX.Element; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentsWithTypeArguments4.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react') declare function OverloadComponent<U>(): JSX.Element; declare function OverloadComponent<U>(attr: {b: U, a: string, "ignore-prop": boolean}): JSX.Element; d...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentsWithTypeArguments5.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react') declare function Component<U>(l: U): JSX.Element; function createComponent<T extends { prop: number }>(arg: T) { let a1 = <Component {...arg} />; l...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxTypeArgumentsJsxPreserveOutput.tsx
TypeScript (TSX)
// @filename: foo.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); type TypeProps = { foo?: boolean; }; interface InterfaceProps { foo?: boolean; } function Foo<T>() { return null; } <> {/* JsxSelfClosingElement */} <Foo<unkn...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxTypeErrors.tsx
TypeScript (TSX)
//@jsx: preserve // A built-in element (OK) var a1 = <div id="foo" />; // A built-in element with a mistyped property (error) var a2 = <img srce="foo.jpg" /> // A built-in element with a badly-typed attribute value (error) var thing = { oops: 100 }; var a3 = <div id={thing} /> // Mistyped html name (error) var e1 =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function SFC1(prop: { x: number }) { return <div>hello</div>; }; function SFC2(prop: { x: boolean }) { return <h1>World </h1>; } var SFCComp = SFC1 || SFC2; <SFCCo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function SFC1(prop: { x: number }) { return <div>hello</div>; }; function SFC2(prop: { x: boolean }) { return <h1>World </h1>; } var SFCComp = SFC1 || SFC2; <SFCCo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class RC1 extends React.Component<{x : number}, {}> { render() { return null; } } class RC2 extends React.Component<{ x: string }, {}> { render() { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType4.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class RC1 extends React.Component<{x : number}, {}> { render() { return null; } } class RC2 extends React.Component<{ x: string }, {}> { render() { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType5.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function EmptySFC1() { return <div>hello</div>; } function EmptySFC2() { return <div>Hello</div>; } function SFC2(prop: { x: boolean }) { return <h1>World</h1>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionElementType6.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function EmptySFC1() { return <div>Hi</div> } function EmptySFC2() { return <div>Hello</div> } function SFC2(prop: { x: boolean }) { return <h1>World</h1>; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionTypeComponent1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ComponentProps { AnyComponent: React.StatelessComponent<any> | React.ComponentClass<any>; } class MyComponent extends React.Component<ComponentProps, {}> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxUnionTypeComponent2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: react // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); type Invalid1 = React.ComponentClass<any> | number; const X: Invalid1 = 1; <X />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tupleElementTypes1.ts
TypeScript
var [a, b]: [number, any] = [undefined, undefined];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tupleElementTypes2.ts
TypeScript
function f([a, b]: [number, any]) { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tupleElementTypes3.ts
TypeScript
var [a, b] = [0, undefined];
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tupleElementTypes4.ts
TypeScript
function f([a, b] = [0, undefined]) { }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tupleLengthCheck.ts
TypeScript
declare const a: [number, string] declare const rest: [number, string, ...boolean[]] const a1 = a[1] const a2 = a[2] const a3 = a[1000] const a4 = rest[1] const a5 = rest[2] const a6 = rest[3] const a7 = rest[1000]
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoAccessorsWithSameName2.ts
TypeScript
class C { static get x() { return 1; } static get x() { return 1; } // error } class D { static set x(v) { } static set x(v) { } // error } class E { static get x() { return 1; } static set x(v) { } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoGenericInterfacesDifferingByTypeParameterName.ts
TypeScript
// type parameter names are relevant when choosing whether to merge interface declarations interface A<T> { x: T; } interface A<U> { // error y: U; } interface B<T,U> { x: U; } interface B<T,V> { // error y: V; } module M { interface A<T> { x: T; } interface A<U> { // error ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoGenericInterfacesDifferingByTypeParameterName2.ts
TypeScript
// type parameter names are relevant when choosing whether to merge interface declarations interface B<T, U> { x: U; } interface B<U, T> { // error y: V; } module M { interface B<T, U> { x: U; } interface B<U, T> { // error y: T; } } module M2 { interface B<T, U> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoGenericInterfacesWithDifferentConstraints.ts
TypeScript
interface A<T extends Date> { x: T; } interface A<T extends Number> { // error y: T; } module M { interface B<T extends A<Date>> { x: T; } interface B<T extends A<any>> { // error y: T; } } module M2 { interface A<T extends Date> { x: T; } } module M2 { i...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoGenericInterfacesWithTheSameNameButDifferentArity.ts
TypeScript
interface A<T> { x: T; } interface A<T, U> { // error y: T; } module M { interface A<T> { x: T; } interface A<T, U> { // error y: T; } } module M2 { interface A<T> { x: T; } } module M2 { interface A<T, U> { // ok, different declaration space than other M...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoInterfacesDifferentRootModule.ts
TypeScript
// two interfaces with different root modules should not merge module M { export interface A { foo: string; } export interface B<T> { foo: T; } } module M2 { export interface A { bar: number; } var a: A; var r1 = a.foo; // error var r2 = a.bar; expor...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoInterfacesDifferentRootModule2.ts
TypeScript
// two interfaces with different root modules should not merge module M { export interface A { foo: string; } export interface B<T> { foo: T; } module M2 { export interface A { bar: number; } var a: A; var r1 = a.foo; // error v...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoMergedInterfacesWithDifferingOverloads.ts
TypeScript
// interfaces that merge must not have members that conflict interface A { foo(x: number): number; foo(x: string): string; } interface A { foo(x: Date): Date; } interface B<T> { foo(x: T): number; foo(x: string): string; } interface B<T> { foo(x: T): Date; foo(x: Date): string; } var b:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/twoMergedInterfacesWithDifferingOverloads2.ts
TypeScript
interface A { (): string; (x: number): number; } interface A { (x: number, y: number): boolean; } var a: A; var r = a(); var r2 = a(1); var r3 = a(1, 2); module G { interface A<T> { (): string; (x: T): T; } interface A<T> { (x: T, y: number): T; <U>(x: U, y: T...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAliases.ts
TypeScript
// Writing a reference to a type alias has exactly the same effect as writing the aliased type itself. type T1 = number; var x1: number; var x1: T1; type T2 = string; var x2: string; var x2: T2; type T3 = boolean; var x3: boolean; var x3: T3; type T4 = void; var x4: void; var x4: T4; type T5 = any; var x5: any; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAliasesDoNotMerge.ts
TypeScript
export type A = {} type A = {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAliasesForObjectTypes.ts
TypeScript
type T1 = { x: string } // An interface can be named in an extends or implements clause, but a type alias for an object type literal cannot. interface I1 extends T1 { y: string } class C1 implements T1 { x: string; } // An interface can have multiple merged declarations, but a type alias for an object type litera...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAndNamespaceExportMerge.ts
TypeScript
// @strict // @Filename: constants.ts export const COFFEE = 0; export const TEA = 1; // @Filename: drink.ts export type Drink = 0 | 1; export * as Drink from "./constants"; // @Filename: index.ts import { Drink } from "./drink"; // 'Drink' only refers to a type, but is being used as a value here const x: Drink = D...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInference.ts
TypeScript
// Generic call with no parameters function noParams<T>() { } noParams(); noParams<string>(); noParams<{}>(); // Generic call with parameters but none use type parameter type function noGenericParams<T>(n: string) { } noGenericParams(''); noGenericParams<number>(''); noGenericParams<{}>(''); // Generic call with mult...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceConstructSignatures.ts
TypeScript
// Generic call with no parameters interface NoParams { new <T>(); } var noParams: NoParams; new noParams(); new noParams<string>(); new noParams<{}>(); // Generic call with parameters but none use type parameter type interface noGenericParams { new <T>(n: string); } var noGenericParams: noGenericParams; new n...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceErrors.ts
TypeScript
// Generic call with multiple type parameters and only one used in parameter type annotation function someGenerics1<T, U>(n: T, m: number) { } someGenerics1<string, number>(3, 4); // Error // 2 parameter generic call with argument 1 of type parameter type and argument 2 of function type whose parameter is of type para...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceTransitiveConstraints.ts
TypeScript
function fn<A extends Date, B extends A, C extends B>(a: A, b: B, c: C) { return [a, b, c]; } var d = fn(new Date(), new Date(), new Date()); var d: Date[]; // Should be OK (d should be Date[])
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceWithClassExpression1.ts
TypeScript
function foo<T>(x = class { static prop: T }): T { return undefined; } foo(class { static prop = "hello" }).length;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceWithClassExpression2.ts
TypeScript
function foo<T>(x = class { prop: T }): T { return undefined; } // Should not infer string because it is a static property foo(class { static prop = "hello" }).length;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceWithClassExpression3.ts
TypeScript
function foo<T>(x = class { prop: T }): T { return undefined; } foo(class { prop = "hello" }).length;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceWithConstraints.ts
TypeScript
// Generic call with no parameters function noParams<T extends {}>() { } noParams(); noParams<string>(); noParams<{}>(); // Generic call with parameters but none use type parameter type function noGenericParams<T extends number>(n: string) { } noGenericParams(''); // Valid noGenericParams<number>(''); noGenericParams<...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentInferenceWithObjectLiteral.ts
TypeScript
interface Computed<T> { read(): T; write(value: T); } function foo<T>(x: Computed<T>) { } var s: string; // Calls below should infer string for T and then assign that type to the value parameter foo({ read: () => s, write: value => s = value }); foo({ write: value => s = value, read: () => s ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeArgumentsWithStringLiteralTypes01.ts
TypeScript
// @declaration: true declare function randBool(): boolean; declare function takeReturnString(str: string): string; declare function takeReturnHello(str: "Hello"): "Hello"; declare function takeReturnHelloWorld(str: "Hello" | "World"): "Hello" | "World"; function fun1<T>(x: T, y: T) { return randBool() ? x : y; }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAssertionsWithIntersectionTypes01.ts
TypeScript
interface I1 { p1: number } interface I2 extends I1 { p2: number; } interface I3 { p3: number; } var x = { p1: 10, p2: 20, p3: 30 }; var y: I1 & I3 = x; var z: I2 = x; var a = <I1 & I3>z; var b = <I3>z; var c = <I2>z; var d = <I1>y;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeAssertionsWithUnionTypes01.ts
TypeScript
interface I1 { p1: number } interface I2 extends I1 { p2: number; } var x = { p1: 10, p2: 20 }; var y: number | I2 = x; var z: I1 = x; var a = <number | I2>z; var b = <number>z; var c = <I2>z; var d = <I1>y;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromContextualThisType.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @strict: true // @Filename: bug25926.js /** @type {{ a(): void; b?(n: number): number; }} */ const o1 = { a() { this.b = n => n; } }; /** @type {{ d(): void; e?(n: number): number; f?(n: number): number; g?: number }} */ const o2 = { d() { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromJSConstructor.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: true // @noImplicitAny: true // @Filename: a.js function Installer () { // arg: number this.arg = 0 // unknown: string | boolean | null this.unknown = null // twice: string | undefined this.twice = undefined this.twic...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromJSInitializer.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: true // @noImplicitAny: true // @Filename: a.js function A () { // should get any on this-assignments in constructor this.unknown = null this.unknowable = undefined this.empty = [] } var a = new A() a.unknown = 1 a.unknown = true...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromJSInitializer2.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: true // @noImplicitAny: true // @Filename: a.js /** @type {() => undefined} */ function f1() { return undefined; } const a = f1() /** @type {() => null} */ function f2() { return null; } const b = f2()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromJSInitializer3.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: false // @noImplicitAny: true // @Filename: a.js /** @type {() => undefined} */ function f1() { return undefined; } const a = f1() /** @type {() => null} */ function f2() { return null; } const b = f2()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromJSInitializer4.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: false // @noImplicitAny: true // @Filename: a.js /** @type {number | undefined} */ var n; // should get any on parameter initialisers function f(a = null, b = n, l = []) { // a should be any a = undefined a = null a = 1 a =...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromParamTagForFunction.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @module: commonjs // @filename: node.d.ts declare function require(id: string): any; declare var module: any, exports: any; // @filename: a-ext.js exports.A = function () { this.x = 1; }; // @filename: a.js const { A } = require("./a-ext"); /** @param {A} p...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPrivatePropertyAssignment.ts
TypeScript
// @target: esnext type Foo = { foo?: string }; class C { #a?: Foo; #b?: Foo; m() { const a = this.#a || {}; this.#b = this.#b || {}; } }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPrivatePropertyAssignmentJs.ts
TypeScript
// @target: esnext // @allowJs: true // @checkJs: true // @outDir: ./out // @filename: typeFromPrivatePropertyAssignmentJs.js // @filename: a.js class C { /** @type {{ foo?: string } | undefined } */ #a; /** @type {{ foo?: string } | undefined } */ #b; m() { const a = this.#a || {}; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js var Outer = class O { m(x, y) { } } Outer.Inner = class I { n(a, b) { } } /** @type {Outer} */ var si si.m /** @type {Outer.Inner} */ var oi oi.n
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment10.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: module.js var Outer = Outer || {}; Outer.app = Outer.app || {}; // @Filename: someview.js Outer.app.SomeView = (function () { var SomeView = function() { var me = this; } return SomeView; })(); Outer.app.Inner = clas...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment10_1.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: esnext // @Filename: module.js var Outer = Outer ?? {}; Outer.app = Outer.app ?? {}; // @Filename: someview.js Outer.app.SomeView = (function () { var SomeView = function() { var me = this; } return SomeView; })(); Outer.app.Inner = c...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment11.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: module.js var Inner = function() {} Inner.prototype = { m() { }, i: 1 } // incremental assignments still work Inner.prototype.j = 2 /** @type {string} */ Inner.prototype.k; var inner = new Inner() inner.m() inner.i inner.j inner....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment12.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: module.js var Outer = function(element, config) {}; // @Filename: usage.js /** @constructor */ Outer.Pos = function (line, ch) {}; /** @type {number} */ Outer.Pos.prototype.line; var pos = new Outer.Pos(1, 'x'); pos.line;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment13.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: module.js var Outer = {} Outer.Inner = function() {} Outer.Inner.prototype = { m() { }, i: 1 } // incremental assignments still work Outer.Inner.prototype.j = 2 /** @type {string} */ Outer.Inner.prototype.k; var inner = new Outer...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment14.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: def.js var Outer = {}; // @Filename: work.js Outer.Inner = function () {} Outer.Inner.prototype = { x: 1, m() { } } // @Filename: use.js /** @type {Outer.Inner} */ var inner inner.x inner.m() var inno = new Outer.Inner() inno.x inno.m()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment15.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js var Outer = {}; Outer.Inner = class { constructor() { this.x = 1 } m() { } } /** @type {Outer.Inner} */ var inner inner.x inner.m() var inno = new Outer.Inner() inno.x inno.m()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment16.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js var Outer = {}; Outer.Inner = function () {} Outer.Inner.prototype = { x: 1, m() { } } /** @type {Outer.Inner} */ var inner inner.x inner.m() var inno = new Outer.Inner() inno.x inno.m()
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment17.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: types.d.ts declare var require: any; declare var module: any; // @Filename: minimatch.js /// <reference path='./types.d.ts'/> module.exports = minimatch minimatch.M = M minimatch.filter = filter function filter() { return minimatch() } function mini...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment18.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js var GLOBSTAR = m.GLOBSTAR = {} function m() { } GLOBSTAR.p = 1 m.GLOBSTAR.q = 2 GLOBSTAR.p GLOBSTAR.q m.GLOBSTAR.p m.GLOBSTAR.q
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment19.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: types.d.ts declare var require: any; declare var module: any; // @Filename: semver.js /// <reference path='./types.d.ts'/> exports = module.exports = C C.f = n => n + 1 function C() { this.p = 1 } // @filename: index.js /// <reference path='./types....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment2.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js function Outer() { this.y = 2 } Outer.Inner = class I { constructor() { this.x = 1 } } /** @type {Outer} */ var ok ok.y /** @type {Outer.Inner} */ var oc oc.x
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment20.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @Filename: bluebird.js !function outer (f) { return f }( function inner () { function Async() { this._trampolineEnabled = true; } Async.prototype.disableTrampolineIfNecessary = function dtin(b) { if (b) { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment21.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @lib: dom, es5 // @Filename: chrome-devtools-DOMExtension.js // Extend that DOM! (doesn't work, but shouldn't crash) Event.prototype.removeChildren = function () { this.textContent = 'nope, not going to happen' }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment22.ts
TypeScript
// @allowJs: true // @checkJs: true // @noEmit: true // @strictNullChecks: true // @Filename: npm-install.js function Installer () { this.args = 0 } Installer.prototype.loadArgMetadata = function (next) { // ArrowFunction isn't treated as a this-container (args) => { this.args = 'hi' this.ne...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment23.ts
TypeScript
// @noEmit: true // @checkJs: true // @allowJs: true // @Filename: a.js class B { constructor () { this.n = 1 } foo() { } } class C extends B { } // this override should be fine (even if it's a little odd) C.prototype.foo = function() { } class D extends B { } D.prototype.foo = () => { t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment24.ts
TypeScript
// @noEmit: true // @checkJs: true // @allowJs: true // @Filename: usage.js // note that usage is first in the compilation Outer.Inner.Message = function() { }; var y = new Outer.Inner() y.name /** @type {Outer.Inner} should be instance type, not static type */ var x; x.name // @Filename: def.js var Outer = {} Outer....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment25.ts
TypeScript
// @noEmit: true // @checkJs: true // @allowJs: true // @Filename: bug24703.js var Common = {}; Common.I = class { constructor() { this.i = 1 } } Common.O = class extends Common.I { constructor() { super() this.o = 2 } } var o = new Common.O() var i = new Common.I() o.i o.o i.i
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment26.ts
TypeScript
// @noEmit: true // @noImplicitAny: true // @checkJs: true // @allowJs: true // @Filename: bug24730.js var UI = {} UI.TreeElement = class { constructor() { this.treeOutline = 12 } }; UI.context = new UI.TreeElement() class C extends UI.TreeElement { onpopulate() { this.doesNotExist ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment27.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js // mixed prototype-assignment+function declaration function C() { this.p = 1; } C.prototype = { q: 2 }; const c = new C() c.p c.q
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment28.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js // mixed prototype-assignment+class declaration class C { constructor() { this.p = 1; } } // Property assignment does nothing. // You have to use Object.defineProperty(C, "prototype", { q: 2 }) // and that only works on classes with no superclass. ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment29.ts
TypeScript
// @declaration: true function ExpandoDecl(n: number) { return n.toString(); } ExpandoDecl.prop = 2 ExpandoDecl.m = function(n: number) { return n + 1; } var n = ExpandoDecl.prop + ExpandoDecl.m(12) + ExpandoDecl(101).length const ExpandoExpr = function (n: number) { return n.toString(); } ExpandoExpr.prop...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment3.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js var Outer = function O() { this.y = 2 } Outer.Inner = class I { constructor() { this.x = 1 } } /** @type {Outer} */ var ja ja.y /** @type {Outer.Inner} */ var da da.x
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment30.ts
TypeScript
interface Combo { (): number; p?: { [s: string]: number }; } const c: Combo = () => 1 // should not be an expando object, but contextually typed by Combo.p c.p = {}
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment31.ts
TypeScript
function ExpandoMerge(n: number) { return n; } ExpandoMerge.p1 = 111 ExpandoMerge.m = function(n: number) { return n + 1; } namespace ExpandoMerge { export var p2 = 222; } ExpandoMerge.p4 = 44444; // ok ExpandoMerge.p6 = 66666; // ok ExpandoMerge.p8 = false; // type error namespace ExpandoMerge { export...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment32.ts
TypeScript
// @Filename: expando.ts function ExpandoMerge(n: number) { return n; } ExpandoMerge.p1 = 111 ExpandoMerge.m = function(n: number) { return n + 1; } ExpandoMerge.p4 = 44444; ExpandoMerge.p5 = 555555; ExpandoMerge.p6 = 66666; ExpandoMerge.p7 = 777777; ExpandoMerge.p8 = false; // type error ExpandoMerge.p9 = fals...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment33.ts
TypeScript
// @Filename: ns.ts namespace ExpandoMerge { export var p3 = 333; export var p4 = 4; export var p5 = 5; export let p6 = 6; export let p7 = 7; export var p8 = 6; export let p9 = 7; } namespace ExpandoMerge { export var p2 = 222; } // @Filename: expando.ts function ExpandoMerge(n: number...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment34.ts
TypeScript
// @noEmit: true // @allowjs: true // @checkjs: true // @Filename: file1.js var N = {}; N.commands = {}; // @Filename: file2.js N.commands.a = 111; N.commands.b = function () { };
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment35.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: bug26877.js /** @param {Emu.D} x */ function ollKorrect(x) { x._model const y = new Emu.D() const z = Emu.D._wrapperInstance; } Emu.D = class { constructor() { this._model = 1 } } // @Filename: second.js var Emu = {} /** @t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment36.ts
TypeScript
// @strict: true function f(b: boolean) { function d() { } d.e = 12 d.e if (b) { d.q = false } // error d.q might not be assigned d.q if (b) { d.q = false } else { d.q = true } d.q if (b) { d.r = 1 } else { d.r = 2 ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment37.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: mod.js const util = exports = module.exports = {} if (!!false) { util.existy = function () { } } // @Filename: use.js const util = require('./mod') function n() { util.existy // no error } util.existy // no error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment38.ts
TypeScript
// @noEmit: true // @strict: true // @declaration: true function F() {} F["prop"] = 3; const f = function () {}; f["prop"] = 3;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment39.ts
TypeScript
// @allowJs: true // @checkJs: true // @strict: true // @emitDeclarationOnly: true // @declaration: true // @Filename: a.js const foo = {}; foo["baz"] = {}; foo["baz"]["blah"] = 3;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment4.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: def.js var Outer = {}; // @Filename: a.js Outer.Inner = class { constructor() { /** @type {number} */ this.y = 12 } } /** @type {Outer.Inner} */ var local local.y var inner = new Outer.Inner() inner.y // @Filename: b.js /** @...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment40.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: typeFromPropertyAssignment40.js function Outer() { var self = this self.y = 2 } /** @type {Outer} */ var ok ok.y
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment5.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @Filename: a.js // @target: es6 export default function MyClass() { } MyClass.bar = class C { } MyClass.bar // @Filename: b.js import MC from './a' MC.bar /** @type {MC.bar} */ var x
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment6.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: def.js class Outer {} // @Filename: a.js Outer.Inner = class I { messages() { return [] } } /** @type {!Outer.Inner} */ Outer.i // @Filename: b.js var msgs = Outer.i.messages() /** @param {Outer.Inner} inner */ function x(inner) {...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment7.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: a.js var obj = {}; obj.method = function (hunch) { return true; } var b = obj.method();
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment8.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @lib: es6,dom // @Filename: a.js var my = my || {}; my.app = my.app || {}; my.app.Application = (function () { var Application = function () { //... }; return Application; })(); my.app.Application() // @Filename: b.js var min = window.min || ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment8_1.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: esnext // @lib: es6,dom // @Filename: a.js var my = my ?? {}; my.app = my.app ?? {}; my.app.Application = (function () { var Application = function () { //... }; return Application; })(); my.app.Application() // @Filename: b.js var min = window.min ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment9.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es6 // @Filename: a.js var my = my || {}; /** @param {number} n */ my.method = function(n) { return n + 1; } my.number = 1; my.object = {}; my.predicate = my.predicate || {}; my.predicate.query = function () { var me = this; me.property = fal...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignment9_1.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: esnext // @Filename: a.js var my = my ?? {}; /** @param {number} n */ my.method = function(n) { return n + 1; } my.number = 1; my.object = {}; my.predicate = my.predicate ?? {}; my.predicate.query = function () { var me = this; me.property = ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/typeFromPropertyAssignmentOutOfOrder.ts
TypeScript
// @noEmit: true // @allowJs: true // @checkJs: true // @target: es5 // @filename: index.js First.Item = class I {} Common.Object = class extends First.Item {} Workspace.Object = class extends Common.Object {} /** @type {Workspace.Object} */ var am; // @filename: roots.js var First = {}; var Common = {}; var Workspa...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University