Skip to content
This repository was archived by the owner on Sep 21, 2019. It is now read-only.

Support stateless component #23

Merged
merged 4 commits into from
Jan 20, 2018

Conversation

vincentbel
Copy link
Contributor

@vincentbel vincentbel commented Jan 20, 2018

Fix #14.

Here I remove react-hoist-generics-transform and do hoist in react-js-make-props-and-state-transform for the following reasons:

  • It is just a little work to do the hoist in place(create type alias, insert it into SourceFile), no need to do lots of check in react-hoist-generics-transform.
  • Stateless components also need to hoist, if we do hoist separately, we need to check again.

Besides, people seldom add a type alias if there are no props/state, So I inline it if it is empty:

// Before:
type MyComponentProps = {}
type MyComponentState = {}
class MyComponent extend React.Component<MyComponentProps, MyComponentState> {}


// After:
class MyComponent extend React.Component<{}, {}> {}

@mohsen1 mohsen1 merged commit f84e4e8 into lyft:master Jan 20, 2018
@theKashey
Copy link

Just a birthday present.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants