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 = <string_named />; // TODO: This should not be a parse error (should // parse a property name here, not identifier) // var c = <var />; var d = <Other />; var e = <Dotted.Name />;
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): { x: number; render: any; }; } var Obj2: Obj2type; <Obj2 x={32} render={100} />; // OK
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: Obj2type; <Obj2 x={10} />; // Error interface Obj3type { new(n: string): { x: number; }; } var Obj3: Obj3type; <Obj3 x={10} />; // OK
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 }; } var Obj2: Obj2type; <Obj2 x={10} />; // OK interface Obj3type { new(n: string): { x: number; }; } var Obj3: Obj3type; <Obj3 x={10} />; // Error var attributes: any; <Obj3 {...attributes} />; // Error <Obj3 {...{}} />; // OK interface Obj4type { new(n: string): { x: number; pr: { x: number; } }; } var Obj4: Obj4type; <Obj4 x={10} />; // OK <Obj4 x={'10'} />; // Error
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 s1 and elide s2 import s1 = require('elements1'); import s2 = require('elements2'); <s1.MyElement />;
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; <Obj1 />; // OK, prefer construct signatures interface Obj2 { (): number; } var Obj2: Obj2; <Obj2 />; // Error interface Obj3 { } var Obj3: Obj3; <Obj3 />; // Error
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: number }; (n: number): { y: string }; } var Obj2: Obj2; <Obj2 />; // Error, return type is not an object type interface Obj3 { (n: string): { x: number }; (n: number): { x: number; y: string }; } var Obj3: Obj3; <Obj3 x={42} />; // OK
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' />; var selfClosed6 = <div x={"1"} y='0' />; var selfClosed7 = <div x={p} y='p' />; var openClosed1 = <div></div>; var openClosed2 = <div n='m'>foo</div>; var openClosed3 = <div n='m'>{p}</div>; var openClosed4 = <div n='m'>{p < p}</div>; var openClosed5 = <div n='m'>{p > p}</div>; class SomeClass { f() { var rewrites1 = <div>{() => this}</div>; var rewrites2 = <div>{[p, ...p, p]}</div>; var rewrites3 = <div>{{p}}</div>; var rewrites4 = <div a={() => this}></div>; var rewrites5 = <div a={[p, ...p, p]}></div>; var rewrites6 = <div a={{p}}></div>; } } var whitespace1 = <div> </div>; var whitespace2 = <div> {p} </div>; var whitespace3 = <div> {p} </div>;
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 {...p1} x={p3} >{p2}</div>; var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</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 />; export module S { // Emit M.Foo Foo, <Foo />; // Emit S.Bar Bar, <Bar />; } } module M { // Emit M.S.Bar S.Bar, <S.Bar />; } module M { var M = 100; // Emit M_1.Foo Foo, <Foo />; }
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> { render() { return <Button />; } } //@filename: button.tsx import * as React from 'react'; export class Button extends React.Component<any, any> { render() { return <button>Some button</button>; } }
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}></Foo>;
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 <><span>hi</span><div>bye</div></>; // children <><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments <>#</>; // # would cause scanning error if not in jsxtext
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>hi</span><div>bye</div></>; // children <><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments <>#</>; // # would cause scanning error if not in jsxtext
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 decorator2 = function <T extends { x: number }>(Component: React.StatelessComponent<T>): React.StatelessComponent<T> { return (props) => <Component {...props} x={2} ></Component> }; const decorator3 = function <T extends { x: number }, U extends { x: number } >(Component: React.StatelessComponent<T>): React.StatelessComponent<T> { return (props) => <Component x={2} {...props} ></Component> };
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={"blah"} ></Component> };
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<U, {}> { render() { return <B1 {...this.props} x="hi" />; } }
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, {}> { render() { return <B1 {...this.props} x="hi" />; } }
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, {}> { props: U; render() { return <B1 {...this.props} x="hi" />; } }
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<U, {}> { props: U; render() { return <B1 {...this.props} x="hi" />; } }
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 extends {x: string}>(props: U) { return <Component {...props} x="hi"/>; }
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 extends {x: string}>(props: U) { return <Component {...props} />; }
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 {...this.props } /> ); } }; }
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" />)}</div>; // worked (!) <div>{() => <div text="wat"></div>}</div>;
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: { text?: string; width?: number; } span: any; } } interface I { new(n: string): { x: number render(): void } } var E: I; <E x={10} />
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 U> ? PropTypeChecker<T, U>[typeof checkedType] : {}}; declare const checkedType: unique symbol; interface PropTypeChecker<U, TRequired = false> { (props: any, propName: string, componentName: string, location: any, propFullName: string): boolean; isRequired: PropTypeChecker<U, true>; [checkedType]: TRequired extends true ? U : U | null | undefined; } declare namespace PropTypes { export const number: PropTypeChecker<number>; export const string: PropTypeChecker<string>; export const node: PropTypeChecker<ReactNode>; } type ReactNode = string | number | ReactComponent<{}, {}>; declare class ReactComponent<P={}, S={}> { constructor(props: P); props: P & Readonly<{children: ReactNode[]}>; setState(s: Partial<S>): S; render(): ReactNode; } declare namespace JSX { interface Element extends ReactComponent {} interface IntrinsicElements {} type LibraryManagedAttributes<TComponent, TProps> = TComponent extends { defaultProps: infer D; propTypes: infer P; } ? Defaultize<TProps & InferredPropTypes<P>, D> : TComponent extends { defaultProps: infer D } ? Defaultize<TProps, D> : TComponent extends { propTypes: infer P } ? TProps & InferredPropTypes<P> : TProps; } class Component extends ReactComponent { static propTypes = { foo: PropTypes.number, bar: PropTypes.node, baz: PropTypes.string.isRequired, }; static defaultProps = { foo: 42, } } const a = <Component foo={12} bar="yes" baz="yeah" />; const b = <Component foo={12} />; // Error, missing required prop bar const c = <Component bar="yes" baz="yeah" />; const d = <Component bar="yes" baz="yo" bat="ohno" />; // Error, baz not a valid prop const e = <Component foo={12} bar={null} baz="cool" />; // bar is nullable/undefinable since it's not marked `isRequired` const f = <Component foo={12} bar="yeah" baz={null} />; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` class JustPropTypes extends ReactComponent { static propTypes = { foo: PropTypes.number, bar: PropTypes.node.isRequired, }; } const g = <JustPropTypes foo={12} bar="ok" />; const h = <JustPropTypes foo="no" />; // error, wrong type const i = <JustPropTypes foo={null} bar="ok" />; const j = <JustPropTypes foo={12} bar={null} />; // error, bar is required class JustDefaultProps extends ReactComponent { static defaultProps = { foo: 42, }; } const k = <JustDefaultProps foo={12} />; const l = <JustDefaultProps foo={12} bar="ok" />; // error, no prop named bar const m = <JustDefaultProps foo="no" />; // error, wrong type interface FooProps { foo: string; } class BothWithSpecifiedGeneric extends ReactComponent<FooProps> { static propTypes = { foo: PropTypes.string, bar: PropTypes.node, baz: PropTypes.number.isRequired, }; static defaultProps = { foo: "yo", }; } const n = <BothWithSpecifiedGeneric foo="fine" bar="yes" baz={12} />; const o = <BothWithSpecifiedGeneric foo="no" />; // Error, missing required prop bar const p = <BothWithSpecifiedGeneric bar="yes" baz={12} />; const q = <BothWithSpecifiedGeneric bar="yes" baz={12} bat="ohno" />; // Error, baz not a valid prop const r = <BothWithSpecifiedGeneric foo="no" bar={null} baz={0} />; // bar is nullable/undefinable since it's not marked `isRequired` const s = <BothWithSpecifiedGeneric foo="eh" bar="yeah" baz={null} />; // Error, baz is _not_ nullable/undefinable since it's marked `isRequired` class JustPropTypesWithSpecifiedGeneric extends ReactComponent<FooProps> { static propTypes = { foo: PropTypes.string, bar: PropTypes.node.isRequired, }; } const t = <JustPropTypesWithSpecifiedGeneric foo="nice" bar="ok" />; const u = <JustPropTypesWithSpecifiedGeneric foo={12} />; // error, wrong type const v = <JustPropTypesWithSpecifiedGeneric foo={null} bar="ok" />; // generic overrides propTypes required-ness, null isn't valid const w = <JustPropTypesWithSpecifiedGeneric foo="cool" bar={null} />; // error, bar is required class JustDefaultPropsWithSpecifiedGeneric extends ReactComponent<FooProps> { static defaultProps = { foo: "no", }; } const x = <JustDefaultPropsWithSpecifiedGeneric foo="eh" />; const y = <JustDefaultPropsWithSpecifiedGeneric foo="no" bar="ok" />; // error, no prop named bar const z = <JustDefaultPropsWithSpecifiedGeneric foo={12} />; // error, wrong type const aa = <JustDefaultPropsWithSpecifiedGeneric />;
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 dependency list import React = require('react'); import ReactRouter = require('react-router'); import Route = ReactRouter.Route; var routes1 = <Route />; module M { export var X: any; } module M { // Should emit 'M.X' in both opening and closing tags var y = <X></X>; }
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 = <MyComp a="hi"/>
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 /> // OK let x = <MyComp a={10} b="hi" /> // Error let x2 = <MyComp a="hi"/>
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 = <div x={0} y='0' />; var selfClosed6 = <div x={"1"} y='0' />; var selfClosed7 = <div x={p} y='p' b />; var openClosed1 = <div></div>; var openClosed2 = <div n='m'>foo</div>; var openClosed3 = <div n='m'>{p}</div>; var openClosed4 = <div n='m'>{p < p}</div>; var openClosed5 = <div n='m' b>{p > p}</div>; class SomeClass { f() { var rewrites1 = <div>{() => this}</div>; var rewrites2 = <div>{[p, ...p, p]}</div>; var rewrites3 = <div>{{p}}</div>; var rewrites4 = <div a={() => this}></div>; var rewrites5 = <div a={[p, ...p, p]}></div>; var rewrites6 = <div a={{p}}></div>; } } var whitespace1 = <div> </div>; var whitespace2 = <div> {p} </div>; var whitespace3 = <div> {p} </div>;
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>; var spreads4 = <div {...p1} x={p3} >{p2}</div>; var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
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.__spread var foo: any; var spread1 = <div x='' {...foo} y='' />;
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: any; var spread1 = <div x='' {...foo} y='' />; // Quotes var x = <div>This "quote" thing</div>; }
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="val"></div>; var b = <div xx="val"></div>; var c = <div xxx="val"></div>; var d = <div xxxx="val"></div>; var e = <div xxxxx="val"></div>;
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 nothing <div>\n</div>; // Also works in string literal attributes <div attr="&#0123;&hellip;&#x7D;\"></div>; // Does not happen for a string literal that happens to be inside an attribute (and escapes then work) <div attr={"&#0123;&hellip;&#x7D;\""}></div>; // Preserves single quotes <div attr='"'></div>; // https://github.com/microsoft/TypeScript/issues/35732 <div>&#x1F408;&#x1F415;&#128007;&#128017;</div>;
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;</h1> <input class="new-todo" autofocus autocomplete="off" placeholder="What needs to be done?" value={model.newTodo} onKeyup={ctrl.addTodo.bind(ctrl, model)} /> </header> <section class="main" style={{display:(model.todos && model.todos.length) ? "block" : "none"}}> <input class="toggle-all" type="checkbox" onChange={ctrl.toggleAll.bind(ctrl)}/> <ul class="todo-list"> {model.filteredTodos.map((todo) => <li class={{todo: true, completed: todo.completed, editing: todo == model.editedTodo}}> <div class="view"> {(!todo.editable) ? <input class="toggle" type="checkbox"></input> : null } <label onDoubleClick={()=>{ctrl.editTodo(todo)}}>{todo.title}</label> <button class="destroy" onClick={ctrl.removeTodo.bind(ctrl,todo)}></button> <div class="iconBorder"> <div class="icon"/> </div> </div> </li> )} </ul> </section> </section>
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, " " <div> {p} </div>; // Emit only p <div> {p} </div>; // Emit only p <div> {p} </div>; // Emit " 3" <div> 3 </div>; // Emit " 3 " <div> 3 </div>; // Emit "3" <div> 3 </div>; // Emit no args <div> </div>; // Emit "foo bar" <div> foo bar </div>; // Emit "hello\\ world" <div> hello\ world </div>; // Emit " a b c d " <div> a b c d </div>;
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 />; const G = <Greet />;
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 = <Poisoned />;
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 = {}; const obj1: OptionProp = { x: 2 } // Error let y = <Opt {...obj} x={3}/>; let y1 = <Opt {...obj1} x="Hi"/>; let y2 = <Opt {...obj1} x={3}/>; let y3 = <Opt x />;
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 overwrite: string } class OverWriteAttr extends React.Component<Prop, {}> { render() { return <div>Hello</div>; } } let anyobj: any; // OK let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> let x1 = <OverWriteAttr {...obj1} {...obj3} /> let x2 = <OverWriteAttr x={3} overwrite="hi" {...obj1} {...{y: true}} /> let x3 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true, x: 2, overwrite:"world"}} /> let x4 = <OverWriteAttr {...{x: 2}} {...{overwrite: "world"}} {...{y: true}} /> let x5 = <OverWriteAttr {...anyobj} />
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 overwrite: string } class OverWriteAttr extends React.Component<Prop, {}> { render() { return <div>Hello</div>; } } let anyobj: any; // Error let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> let x1 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true}} /> let x2 = <OverWriteAttr {...anyobj} x={3} /> let x3 = <OverWriteAttr overwrite="hi" {...obj1} {...{y: true}} />
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 (condition1) { return ( <ChildComponent {...props} /> ); } else { return (<ChildComponent {...props} property1="NewString" />); } } interface AnotherComponentProps { property1: string; } function ChildComponent({ property1 }: AnotherComponentProps) { return ( <span>{property1}</span> ); }
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 property <AnotherComponent {...props} Property1/> ); } interface AnotherComponentProps { property1: string; } function AnotherComponent({ property1 }: AnotherComponentProps) { return ( <span>{property1}</span> ); }
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 ( <AnotherComponent {...props} property2 AnotherProperty1="hi"/> ); } interface AnotherComponentProps { property1: string; AnotherProperty1: string; property2: boolean; } function AnotherComponent({ property1 }: AnotherComponentProps) { return ( <span>{property1}</span> ); }
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: missing property <AnotherComponent {...props} /> ); } interface AnotherComponentProps { property1: string; AnotherProperty1: string; property2: boolean; } function AnotherComponent({ property1 }: AnotherComponentProps) { return ( <span>{property1}</span> ); }
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.Component<{}, {}> { render() { return <div>Hello</div>; } } declare const obj: { a: number | undefined } | undefined; // OK let unionedSpread = <Empty {...obj} />;
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>; } } const obj = {}; // OK <Poisoned {...{x: "ok", y: "2"}} />; // Error let p = <Poisoned {...obj} />; let y = <Poisoned />; let z = <Poisoned x y/>; let w = <Poisoned {...{x: 5, y: "2"}}/>; let w1 = <Poisoned {...{x: 5, y: "2"}} X="hi" />;
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>; } } const obj = { x: "hello world", y: 2 }; // OK let p = <Poisoned {...obj} />; let y = <Poisoned x="hi" y={2} />;
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>; } } const obj: PoisonedProp = { x: "hello world", y: 2 }; // OK let p = <Poisoned {...obj} />; class EmptyProp extends React.Component<{}, {}> { render() { return <div>Default hi</div>; } } // OK let j: any; let e1 = <EmptyProp {...{}} />; let e2 = <EmptyProp {...j} /> let e3 = <EmptyProp {...{ ref: (input) => { this.textInput = input; } }} /> let e4 = <EmptyProp data-prop /> let e5 = <EmptyProp {...{ "data-prop": true}} />
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>; } } let obj = { x: "hello world", y: 2 }; // Error as "obj" has type { x: string; y: number } let p = <Poisoned {...obj} />; class EmptyProp extends React.Component<{}, {}> { render() { return <div>Default hi</div>; } greeting: string; } let o = { prop1: false } // Ok let e = <EmptyProp {...o} />;
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, {}> { render() { return <span>Some Text..</span>; } } // Error let x = <TextComponent editable={true} /> const textProps: TextProps = { editable: false };
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, {}> { render() { return <span>Some Text..</span>; } } // OK const textPropsFalse: TextProps = { editable: false }; let y1 = <TextComponent {...textPropsFalse} /> const textPropsTrue: TextProps = { editable: true, onEdit: () => {} }; let y2 = <TextComponent {...textPropsTrue} />
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 OverWriteAttr extends React.Component<Prop, {}> { render() { return <div>Hello</div>; } } // OK let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> let x1 = <OverWriteAttr {...obj1} {...obj3} />
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: OptionProp = {}; const obj1: OptionProp = { x: 2 } // OK let p = <Opt />; let y = <Opt {...obj} />; let y1 = <Opt {...obj1} />; let y2 = <Opt {...obj1} y/>; let y3 = <Opt x={2} />;
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>{prop.key.toString() + prop.todo}</div>; } function TodoList({ todos }: TodoListProps) { return <div> {...todos.map(todo => <Todo key={todo.id} todo={todo.todo}/>)} </div>; } let x: TodoListProps; <TodoList {...x}/>
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: string }) { return <div>{prop.key.toString() + prop.todo}</div>; } function TodoList({ todos }: TodoListProps) { return <div> {...<Todo key={todos[0].id} todo={todos[0].todo} />} </div>; } function TodoListNoError({ todos }: TodoListProps) { // any is not checked return <div> {...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)} </div>; } let x: TodoListProps; <TodoList {...x}/>
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 OneThing(l: {yy: number, yy1: string}): JSX.Element; declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element; declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element; // OK const c1 = <OneThing yxx='ok' /> const c2 = <OneThing yy={100} yy1="hello"/> const c3 = <OneThing yxx="hello" ignore-prop /> const c4 = <OneThing data="hello" data-prop /> const c5 = <OneThing yxx1='ok'>Hello</OneThing> declare function TestingOneThing({y1: string}): JSX.Element; declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element; declare function TestingOneThing(n: {yy: number, direction?: number}): JSX.Element; declare function TestingOneThing(n: {yy: string, name: string}): JSX.Element; // OK const d1 = <TestingOneThing y1 extra-data />; const d2 = <TestingOneThing extra-data="hello" />; const d3 = <TestingOneThing extra-data="hello" yy="hihi" />; const d4 = <TestingOneThing extra-data="hello" yy={9} direction={10} />; const d5 = <TestingOneThing extra-data="hello" yy="hello" name="Bob" />; declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; // OK const e1 = <TestingOptional /> const e3 = <TestingOptional y1="hello"/> const e4 = <TestingOptional y1="hello" y2={1000} /> const e5 = <TestingOptional y1 y3/> const e6 = <TestingOptional y1 y3 y2={10} /> const e2 = <TestingOptional y1 y3 extra-prop/>
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" } let obj1 = { yy: true } let obj2 = { yy: 500, "ignore-prop": "hello" } let defaultObj: any; // OK const c1 = <OneThing /> const c2 = <OneThing {...obj}/> const c3 = <OneThing {...{}} /> const c4 = <OneThing {...obj1} {...obj} /> const c5 = <OneThing {...obj1} yy={42} {...{yy1: "hi"}}/> const c6 = <OneThing {...obj1} {...{yy: 10000, yy1: "true"}} /> const c7 = <OneThing {...defaultObj} yy {...obj} />; // No error. should pick second overload const c8 = <OneThing ignore-prop={100} /> const c9 = <OneThing {...{ "ignore-prop":200 }} />; const c10 = <OneThing {...obj2} yy1="boo" />;
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; let obj2: any; // OK const two1 = <ZeroThingOrTwoThing />; const two2 = <ZeroThingOrTwoThing yy={100} yy1="hello"/>; const two3 = <ZeroThingOrTwoThing {...obj2} />; // it is just any so we allow it to pass through const two4 = <ZeroThingOrTwoThing yy={1000} {...obj2} />; // it is just any so we allow it to pass through const two5 = <ZeroThingOrTwoThing {...obj2} yy={1000} />; // it is just any so we allow it to pass through declare function ThreeThing(l: {y1: string}): JSX.Element; declare function ThreeThing(l: {y2: string}): JSX.Element; declare function ThreeThing(l: {yy: number, yy1: string}, context: Context, updater: any): JSX.Element; // OK const three1 = <ThreeThing yy={99} yy1="hello world" />; const three2 = <ThreeThing y2="Bye" />; const three3 = <ThreeThing {...obj2} y2={10} />; // it is just any so we allow it to pass through
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" } let obj2: any; // Error const c0 = <OneThing extraProp />; // extra property; const c1 = <OneThing yy={10}/>; // missing property; const c2 = <OneThing {...obj} yy1 />; // type incompatible; const c3 = <OneThing {...obj} {...{extra: "extra attr"}} />; // This is OK because all attribute are spread const c4 = <OneThing {...obj} y1={10000} />; // extra property; const c5 = <OneThing {...obj} {...{yy: true}} />; // type incompatible; const c6 = <OneThing {...obj2} {...{extra: "extra attr"}} />; // Should error as there is extra attribute that doesn't match any. Current it is not const c7 = <OneThing {...obj2} yy />; // Should error as there is extra attribute that doesn't match any. Current it is not declare function TestingOneThing(j: {"extra-data": string}): JSX.Element; declare function TestingOneThing(n: {yy: string, direction?: number}): JSX.Element; // Error const d1 = <TestingOneThing extra-data /> const d2 = <TestingOneThing yy="hello" direction="left" /> declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element; declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element; declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element; // Error const e1 = <TestingOptional y1 y3="hello"/> const e2 = <TestingOptional y1="hello" y2={1000} y3 /> const e3 = <TestingOptional y1="hello" y2={1000} children="hi" /> const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
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.MouseEventHandler<any>; } export interface LinkProps extends ClickableProps { to: string; } export interface HyphenProps extends ClickableProps { "data-format": string; } let obj0 = { to: "world" }; let obj1 = { children: "hi", to: "boo" } let obj2 = { onClick: ()=>{} } let obj3: any; export function MainButton(buttonProps: ButtonProps): JSX.Element; export function MainButton(linkProps: LinkProps): JSX.Element; export function MainButton(hyphenProps: HyphenProps): JSX.Element; export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { const linkProps = props as LinkProps; if(linkProps.to) { return this._buildMainLink(props); } return this._buildMainButton(props); } // Error const b0 = <MainButton to='/some/path' onClick={(e)=>{}}>GO</MainButton>; // extra property; const b1 = <MainButton onClick={(e: any)=> {}} {...obj0}>Hello world</MainButton>; // extra property; const b2 = <MainButton {...{to: "10000"}} {...obj2} />; // extra property const b3 = <MainButton {...{to: "10000"}} {...{onClick: (k) => {}}} />; // extra property const b4 = <MainButton {...obj3} to />; // Should error because Incorrect type; but attributes are any so everything is allowed const b5 = <MainButton {...{ onClick(e: any) { } }} {...obj0} />; // Spread retain method declaration (see GitHub #13365), so now there is an extra attributes const b6 = <MainButton {...{ onClick(e: any){} }} children={10} />; // incorrect type for optional attribute const b7 = <MainButton {...{ onClick(e: any){} }} children="hello" className />; // incorrect type for optional attribute const b8 = <MainButton data-format />; // incorrect type for specified hyphanated name
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.MouseEventHandler<any>; } export interface LinkProps extends ClickableProps { to: string; } export interface HyphenProps extends ClickableProps { "data-format": string; } let obj = { children: "hi", to: "boo" } let obj1: any; let obj2 = { onClick: () => {} } export function MainButton(buttonProps: ButtonProps): JSX.Element; export function MainButton(linkProps: LinkProps): JSX.Element; export function MainButton(hyphenProps: HyphenProps): JSX.Element; export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element { const linkProps = props as LinkProps; if(linkProps.to) { return this._buildMainLink(props); } return this._buildMainButton(props); } // OK const b0 = <MainButton to='/some/path'>GO</MainButton>; const b1 = <MainButton onClick={(e) => {}}>Hello world</MainButton>; const b2 = <MainButton {...obj} />; const b3 = <MainButton {...{to: 10000}} {...obj} />; const b4 = <MainButton {...obj1} />; // any; just pick the first overload const b5 = <MainButton {...obj1} to="/to/somewhere" />; // should pick the second overload const b6 = <MainButton {...obj2} />; const b7 = <MainButton {...{onClick: () => { console.log("hi") }}} />; const b8 = <MainButton {...{onClick() {}}} />; // OK; method declaration get retained (See GitHub #13365) const b9 = <MainButton to='/some/path' extra-prop>GO</MainButton>; const b10 = <MainButton to='/some/path' children="hi" ></MainButton>; const b11 = <MainButton onClick={(e) => {}} className="hello" data-format>Hello world</MainButton>; const b12 = <MainButton data-format="Hello world" />
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 = <MyComponent values />; // We infer type arguments here let i1 = <MyComponent values="Hello"/>;
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> } // Error let i1 = <MyComponent1 values={5}/>;
willcrichton/ilc-swc
1
Rust
willcrichton
Will Crichton
Brown University