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/tsxDynamicTagName8.tsx
TypeScript (TSX)
// @jsx: preserve //@filename: react.d.ts declare module 'react' { class Component<T, U> { } } //@filename: app.tsx import * as React from 'react'; export class Text extends React.Component<{}, {}> { _tagName: string = 'div'; render() { return ( <this._tagName> Hello world </this._tagName> ); }...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxDynamicTagName9.tsx
TypeScript (TSX)
// @jsx: preserve //@filename: react.d.ts declare module 'react' { class Component<T, U> { } } //@filename: app.tsx import * as React from 'react'; export class Text extends React.Component<{}, {}> { _tagName: "div" = 'div'; render() { return ( <this._tagName> Hello world </this._tagName> ); } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution.tsx
TypeScript (TSX)
//@jsx: preserve declare namespace JSX { interface IntrinsicElements { foundFirst: { x: string }; 'string_named'; 'var'; } } class foundFirst { } class Other {} module Dotted { export class Name { } } // Should find the intrinsic element, not the class element var a = <foundFirst x="hello" />; var b = <st...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution1.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { div: any } } // OK <div />; // Fail <span />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution10.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementClass { render: any; } interface IntrinsicElements { } } interface Obj1type { new(n: string): { x: number }; } var Obj1: Obj1type; <Obj1 x={10} />; // Error, no render member interface Obj2type { (n: string): { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution11.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementAttributesProperty { } interface IntrinsicElements { } } interface Obj1type { new(n: string): any; } var Obj1: Obj1type; <Obj1 x={10} />; // OK interface Obj2type { new(n: string): { q?: number }; } var Obj2: Obj2t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution12.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementAttributesProperty { pr: any; } interface IntrinsicElements { } } interface Obj1type { new(n: string): any; } var Obj1: Obj1type; <Obj1 x={10} />; // OK interface Obj2type { new(n: string): { q?: number; pr: any };...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution13.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementAttributesProperty { pr1: any; pr2: any; } } interface Obj1 { new(n: string): any; } var obj1: Obj1; <obj1 x={10} />; // Error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution14.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } } interface Obj1 { new(n: string): {}; } var obj1: Obj1; <obj1 x={10} />; // OK
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution15.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface ElementAttributesProperty { pr1: any; pr2: any; } interface IntrinsicElements { } } interface Obj1type { new(n: string): {}; } var Obj1: Obj1type; <Obj1 x={10} />; // Error
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution16.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve //@noImplicitAny: true declare module JSX { } interface Obj1 { new(n: string): {}; } var obj1: Obj1; <obj1 x={10} />; // Error (JSX.Element is implicit any)
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution17.tsx
TypeScript (TSX)
//@jsx: preserve //@module: amd //@filename: file.tsx declare module JSX { interface Element { } interface IntrinsicElements { } } declare module 'elements1' { class MyElement { } } declare module 'elements2' { class MyElement { } } //@filename: consumer.tsx ///<reference path="file.tsx" /> // Should keep s...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution18.tsx
TypeScript (TSX)
//@jsx: preserve //@filename: file1.tsx //@noimplicitany: true declare module JSX { interface Element { } } // Error under implicit any <div n='x' />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution19.tsx
TypeScript (TSX)
//@jsx: react //@module: amd //@filename: react.d.ts declare module "react" { } //@filename: file1.tsx declare module JSX { interface Element { } } export class MyClass { } //@filename: file2.tsx // Should not elide React import import * as React from 'react'; import {MyClass} from './file1'; <MyClass />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution2.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [x: string]: any; } } // OK <div />; // OK <span />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution3.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [x: string]: { n: string; }; } } // OK <div n='x' />; // Error <span w='err' />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution4.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { div: { n: string; }; span: { m: string; }; } } // OK <div n='x' />; // OK <span m='ok' />; // Error <span q='' />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution5.tsx
TypeScript (TSX)
//@jsx: preserve //@filename: file1.tsx declare module JSX { interface Element { } } // OK, but implicit any <div n='x' />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution6.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { } } var div: any; // Still an error <div n='x' />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution7.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { } } module my { export var div: any; } // OK <my.div n='x' />; // Error <my.other />; module q { import mine = my; // OK <mine.div n='x' />; // Error <mine.non />; }
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution8.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { } } // Error var Div = 3; <Div />; // OK function Fact(): any { return null; } <Fact /> // Error function Fnum(): number{ return 42; } <Fnum /> interface Obj1 { new(): {}; (): number; } var Obj1: Obj1...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxElementResolution9.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { something; } interface IntrinsicElements { } } interface Obj1 { new(n: string): { x: number }; new(n: number): { y: string }; } var Obj1: Obj1; <Obj1 />; // Error, return type is not an object type interface Obj2 { (n: string): { x: ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxEmit1.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } var p; var selfClosed1 = <div />; var selfClosed2 = <div x="1" />; var selfClosed3 = <div x='1' />; var selfClosed4 = <div x="1" y='0' />; var selfClosed5 = <div x={0} y='0' />; va...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxEmit2.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } var p1: any, p2: any, p3: any; var spreads1 = <div {...p1}>{p2}</div>; var spreads2 = <div {...p1}>{p2}</div>; var spreads3 = <div x={p3} {...p1}>{p2}</div>; var spreads4 = <div {....
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxEmit3.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve //@sourceMap: true declare module JSX { interface Element { } interface IntrinsicElements { } } module M { export class Foo { constructor() { } } export module S { export class Bar { } // Emit Foo // Foo, <Foo />; } } module M { // Emit M.Foo Foo, <Foo />; expor...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxErrorRecovery2.tsx
TypeScript (TSX)
//@jsx: preserve //@filename: file1.tsx declare namespace JSX { interface Element { } } <div></div> <div></div> //@filename: file2.tsx var x = <div></div><div></div>
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxErrorRecovery3.tsx
TypeScript (TSX)
//@jsx: react //@filename: file1.tsx declare namespace JSX { interface Element { } } <div></div> <div></div> //@filename: file2.tsx var x = <div></div><div></div>
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxExternalModuleEmit1.tsx
TypeScript (TSX)
//@jsx: preserve //@module: commonjs //@filename: react.d.ts declare module 'react' { class Component<T, U> { } } //@filename: app.tsx import * as React from 'react'; // Should see var button_1 = require('./button') here import { Button } from './button'; export class App extends React.Component<any, any> { r...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxExternalModuleEmit2.tsx
TypeScript (TSX)
//@jsx: react //@module: commonjs //@filename: modules.d.ts declare module 'mod' { var y: any; export default y; } //@filename: app.tsx import Main from 'mod'; declare var Foo, React; // Should see mod_1['default'] in emit here <Foo handler={Main}></Foo>; // Should see mod_1['default'] in emit here <Foo {...Main}...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxFragmentPreserveEmit.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; <></>; // no whitespace < ></ >; // lots of whitespace < /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags <>hi</>; // text inside <><sp...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxFragmentReactEmit.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; <></>; // no whitespace < ></ >; // lots of whitespace < /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags <>hi</>; // text inside <><span>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const decorator = function <T>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> { return (props) => <Component {...props}></Component> }; const de...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const decorator4 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> { return (props) => <Component {...props} y=...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}> { render() { return <div>hi</div>; } } class B<U> extends React.Component...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType4.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class B1<T extends { x: string }> extends React.Component<T, {}> { render() { return <div>hi</div>; } } class B<U> extends React.Component<U, {}> { re...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType5.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class B1<T extends { x: string }> extends React.Component<T, {}> { render() { return <div>hi</div>; } } class B<U> extends React.Component<U, {}> { pr...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType6.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class B1<T extends { x: string } = { x:string } > extends React.Component<T, {}> { render() { return <div>hi</div>; } } class B<U> extends React.Component...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType7.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); declare function Component<T>(props: T) : JSX.Element; const decorator = function <U>(props: U) { return <Component {...props} />; } const decorator1 = function <U ex...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType8.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); declare function Component<T>(props: T) : JSX.Element; const decorator = function <U>(props: U) { return <Component {...props} />; } const decorator1 = function <U ex...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxGenericAttributesType9.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); export function makeP<P>(Ctor: React.ComponentClass<P>) { return class extends React.PureComponent<P, void> { public render(): JSX.Element { return ( <Ctor {...t...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxInArrowFunction.tsx
TypeScript (TSX)
// @jsx: preserve declare namespace JSX { interface Element { } interface IntrinsicElements { div: { text?: string; } } } // didn't work <div>{() => <div text="wat" />}</div>; // didn't work <div>{x => <div text="wat" />}</div>; // worked <div>{() => (<div text="wat" />)}</d...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxIntrinsicAttributeErrors.tsx
TypeScript (TSX)
// @jsx: preserve declare namespace JSX { interface Element { } interface ElementClass { render: any; } interface IntrinsicAttributes { key: string | number } interface IntrinsicClassAttributes<T> { ref: T } interface IntrinsicElements { div: { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxLibraryManagedAttributes.tsx
TypeScript (TSX)
// @jsx: preserve // @strict: true type Defaultize<TProps, TDefaults> = & {[K in Extract<keyof TProps, keyof TDefaults>]?: TProps[K]} & {[K in Exclude<keyof TProps, keyof TDefaults>]: TProps[K]} & Partial<TDefaults>; type InferredPropTypes<P> = {[K in keyof P]: P[K] extends PropTypeChecker<infer T, infer ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxNamespacedAttributeName1.tsx
TypeScript (TSX)
// @jsx: preserve // @filename: a.tsx const a = <svg:path a:b={1}></svg:path>; const b = <svg : path a:b={1}></svg : path>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxNamespacedAttributeName2.tsx
TypeScript (TSX)
// @jsx: react // @filename: a.tsx declare var React: any; const a = <svg:path a:b={1}></svg:path>; const b = <svg : path a:b={1}></svg : path>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxNamespacedTagName1.tsx
TypeScript (TSX)
// @jsx: preserve // @filename: a.tsx const a = <svg:path></svg:path>; const b = <svg : path></svg : path>; const c = <A:foo></A:foo>; const d = <a:foo></a:foo>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxNamespacedTagName2.tsx
TypeScript (TSX)
// @jsx: react // @filename: a.tsx declare var React: any; const a = <svg:path></svg:path>; const b = <svg : path></svg : path>; const c = <A:foo></A:foo>; const d = <a:foo></a:foo>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxNoJsx.tsx
TypeScript (TSX)
//@jsx: preserve <nope />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxOpeningClosingNames.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } } declare module A.B.C { var D: any; } <A.B.C.D>foo</A . B . C.D>
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxParseTests1.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { div; span; } } var x = <div><div><span><div></div></span></div></div>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxParseTests2.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { div; span; } } var x = </**/div></div>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxPreserveEmit1.tsx
TypeScript (TSX)
//@module: amd //@jsx: preserve //@target: ES5 //@Filename: react.d.ts declare module 'react' { var x: any; export = x; } declare module ReactRouter { var Route: any; interface Thing { } } declare module 'react-router' { export = ReactRouter; } //@Filename: test.tsx // Should emit 'react-router' in the AMD depe...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxPreserveEmit2.tsx
TypeScript (TSX)
//@module: amd //@jsx: preserve //@target: ES5 //@Filename: test.tsx var Route: any; var routes1 = <Route />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxPreserveEmit3.tsx
TypeScript (TSX)
//@jsx: preserve //@module: amd //@filename: file.tsx declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } //@filename: test.d.ts export var React; //@filename: react-consumer.tsx // This import should be elided import {React} from "./test";
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactComponentWithDefaultTypeParameter1.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 } declare class MyComp<P = Prop> extends React.Component<P, {}> { internalProp: P; } let x = <MyComp a={10} b="hi" />
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactComponentWithDefaultTypeParameter2.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 } declare class MyComp<P = Prop> extends React.Component<P, {}> { internalProp: P; } let x = <MyComp /> let x1 = <MyCom...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactComponentWithDefaultTypeParameter3.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 } declare class MyComp<P extends Prop> extends React.Component<P, {}> { internalProp: P; } // Error let x1 = <MyComp />...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit1.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; var p; var selfClosed1 = <div />; var selfClosed2 = <div x="1" />; var selfClosed3 = <div x='1' />; var selfClosed4 = <div x="1" y='0' />; var selfClosed5 = <d...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit2.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; var p1: any, p2: any, p3: any; var spreads1 = <div {...p1}>{p2}</div>; var spreads2 = <div {...p1}>{p2}</div>; var spreads3 = <div x={p3} {...p1}>{p2}</div>; v...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit3.tsx
TypeScript (TSX)
//@jsx: react //@filename: test.tsx declare module JSX { interface Element { } } declare var React: any; declare var Foo, Bar, baz; <Foo> <Bar> q </Bar> <Bar/> s <Bar/><Bar/></Foo>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit4.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; var p: any; var openClosed1 = <div> {blah} </div>; // Should emit React.__spread({}, p, {x: 0}) var spread1 = <div {...p} x={0} />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit5.tsx
TypeScript (TSX)
//@jsx: react //@module: commonjs //@filename: file.tsx declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } //@filename: test.d.ts export var React; //@filename: react-consumer.tsx import {React} from "./test"; // Should emit test_1.React.createElement // and React.__...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit6.tsx
TypeScript (TSX)
//@jsx: react //@module: commonjs //@filename: file.tsx declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } //@filename: react-consumer.tsx namespace M { export var React: any; } namespace M { // Should emit M.React.createElement // and M.React.__spread var foo: a...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit7.tsx
TypeScript (TSX)
//@jsx: react //@module: commonjs //@filename: file.tsx declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } var m = <div x-y="val"></div>; var n = <div xx-y="val"></div>; var o = <div x-yy="val"></div>; var p = <div xx-yy="val"></div>; // Investigation var a = <div x="...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmit8.tsx
TypeScript (TSX)
// @jsx: react-jsx,react-jsxdev // @target: esnext /// <reference path="/.lib/react16.d.ts" /> <div>1</div>; <div key={"key-attr"}>2</div>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmitEntities.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; <div>Dot goes here: &middot; &notAnEntity; </div>; <div>Be careful of &quot;-ed strings!</div>; <div>&#0123;&#123;braces&#x7d;&#x7D;</div>; // Escapes do nothi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmitNesting.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react //@reactNamespace: vdom declare var vdom: any; declare var ctrl: any; declare var model: any; // A simple render function with nesting and control statements let render = (ctrl, model) => <section class="todoapp"> <header class="header"> <h1>todos &lt;x&gt;<...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmitWhitespace.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; // THIS FILE HAS TEST-SIGNIFICANT LEADING/TRAILING // WHITESPACE, DO NOT RUN 'FORMAT DOCUMENT' ON IT var p = 0; // Emit " " <div> </div>; // Emit " ", p,...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxReactEmitWhitespace2.tsx
TypeScript (TSX)
//@filename: file.tsx //@jsx: react declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; // Emit ' word' in the last string <div>word <code>code</code> word</div>; // Same here <div><code>code</code> word</div>; // And here <div><code /> word</div>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSfcReturnNull.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) => null; function Greet(x: {name?: string}) { return null; } const foo = <Foo />; const G = <Greet />;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSfcReturnNullStrictNullChecks.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @strictNullChecks: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const Foo = (props: any) => null; function Greet(x: {name?: string}) { return null; } const foo = <Foo />; const G = <Greet /...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSfcReturnUndefinedStrictNullChecks.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @strictNullChecks: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const Foo = (props: any) => undefined; function Greet(x: {name?: string}) { return undefined; } // Error const foo = <Foo />; ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution1.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); class Poisoned extends React.Component<{}, {}> { render() { return <div>Hello</div>; } } const obj = {}; // OK let p = <Poisoned {...obj} />; let y = <Po...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution10.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface OptionProp { x?: 2 } class Opt extends React.Component<OptionProp, {}> { render() { return <div>Hello</div>; } } const obj: OptionProp = {}...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution11.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const obj = {}; const obj1: { x: 2 } = { x: 2 } const obj3: {y: true, overwrite: string } = { y: true, overwrite: "hi" } interface Prop { x: 2 y: true...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution12.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const obj = {}; const obj1: {x: 2} = { x: 2 } const obj3: {y: false, overwrite: string} = { y: false, overwrite: "hi" } interface Prop { x: 2 y: false...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution13.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ComponentProps { property1: string; property2: number; } export default function Component(props: ComponentProps) { let condition1: boolean; if ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution14.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ComponentProps { property1: string; property2: number; } export default function Component(props: ComponentProps) { return ( // Error extra ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution15.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ComponentProps { property1: string; property2: number; } export default function Component(props: ComponentProps) { return ( <AnotherCompone...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution16.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface ComponentProps { property1: string; property2: number; } export default function Component(props: ComponentProps) { return ( // Error: missi...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution17.tsx
TypeScript (TSX)
// @strictNullChecks: true // @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: lib.d.ts declare global { namespace JSX { interface Element {} interface ElementAttributesProperty { props: {} } } } declare var React: any; export class Empty extends React...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution2.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface PoisonedProp { x: string; y: "2"; } class Poisoned extends React.Component<PoisonedProp, {}> { render() { return <div>Hello</div>; } } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface PoisonedProp { x: string; y: number; } class Poisoned extends React.Component<PoisonedProp, {}> { render() { return <div>Hello</div>; } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution4.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface PoisonedProp { x: string; y: 2; } class Poisoned extends React.Component<PoisonedProp, {}> { render() { return <div>Hello</div>; } } co...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution5.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface PoisonedProp { x: string; y: 2; } class Poisoned extends React.Component<PoisonedProp, {}> { render() { return <div>Hello</div>; } } le...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution6.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); type TextProps = { editable: false } | { editable: true, onEdit: (newText: string) => void }; class TextComponent extends React.Component<TextProps, {}> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution7.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); type TextProps = { editable: false } | { editable: true, onEdit: (newText: string) => void }; class TextComponent extends React.Component<TextProps, {}> { ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution8.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); const obj = {}; const obj1 = { x: 2 } const obj3 = { y: true, overwrite: "hi" } interface Prop { x: number y: boolean overwrite: string } class O...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution9.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); interface OptionProp { x?: 2 y?: boolean } class Opt extends React.Component<OptionProp, {}> { render() { return <div>Hello</div>; } } const obj:...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadChildren.tsx
TypeScript (TSX)
//@jsx: preserve declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; interface TodoProp { id: number; todo: string; } interface TodoListProps { todos: TodoProp[]; } function Todo(prop: { key: number, todo: string }) { return <div>...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadChildrenInvalidType.tsx
TypeScript (TSX)
// @jsx: react,react-jsx // @target: es2015,es5 declare module JSX { interface Element { } interface IntrinsicElements { [s: string]: any; } } declare var React: any; interface TodoProp { id: number; todo: string; } interface TodoListProps { todos: TodoProp[]; } function Todo(prop: { key: number, todo...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxSpreadInvalidType.tsx
TypeScript (TSX)
// @jsx: preserve // @strict: true // @filename: a.tsx namespace JSX { export interface IntrinsicElements { [key: string]: any } } const a = {} as never; const b = null; const c = undefined; const d = <div { ...a } /> const e = <div { ...b } /> const f = <div { ...c } />
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload1.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 OneThing(k: {yxx: string}): JSX.Element; declare function OneThing(k: {yxx1: string, children: string}): JSX.Element; declare function OneT...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload2.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 OneThing(): JSX.Element; declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; let obj = { yy: 10, yy1: "hello" } ...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload3.tsx
TypeScript (TSX)
// @filename: file.tsx // @jsx: preserve // @module: amd // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts interface Context { color: any; } declare function ZeroThingOrTwoThing(): JSX.Element; declare function ZeroThingOrTwoThing(l: {yy: number, yy1: string}, context: Context): JSX.Element;...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload4.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 OneThing(): JSX.Element; declare function OneThing(l: {yy: number, yy1: string}): JSX.Element; let obj = { yy: 10, yy1: "hello" } l...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload5.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') export interface ClickableProps { children?: string; className?: string; } export interface ButtonProps extends ClickableProps { onClick: React...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentOverload6.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') export interface ClickableProps { children?: string; className?: string; } export interface ButtonProps extends ClickableProps { onClick: React...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentWithDefaultTypeParameter1.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') interface MyComponentProp { values: string; } function MyComponent<T = MyComponentProp>(attr: T) { return <div>attr.values</div> } // OK let i = <...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University
crates/swc_ecma_parser/tests/tsc/tsxStatelessFunctionComponentWithDefaultTypeParameter2.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') interface MyComponentProp { values: string; } function MyComponent1<T extends MyComponentProp>(attr: T) { return <div>attr.values</div> } // Erro...
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University