More great #OpenSource from Lyft: Convert #ReactJS to #TypeScript with proper typing

More great #OpenSource from Lyft: Convert #ReactJS to #TypeScript with proper typing

  • Tests are organized in folder.
  • For each transform there is a folder that contains folders for each test case.
  • Each test case has and .
  • Pass with transform name and case name space separated to

react-javascript-to-typescript-transform – Convert React JavaScript code to TypeScript with proper typing

GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.

class MyComponent extends React . Component { static propTypes = { prop1: React . PropTypes . string . isRequired, prop2: React . PropTypes . number } constructor() { super(); this . state = { foo: 1, bar: ‘str’ }; } render() { return

{ this . state . foo }, { this . state . bar }, { this . state . baz }

} onClick() { this . setState({ baz: 3 }) } }

type MyComponentProps = { prop1: string; prop2? : number; } type MyComponentState = { foo: number; bar: string; baz: number; } class MyComponent extends React.Component { constructor() { super(); this.state = { foo: 1, bar: ‘str’ }; } render() { return

{this.state.foo}, {this.state.bar}, {this.state.baz}< / div > } onClick() { this.setState({ baz: 3 }) } }

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

GitHub