Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types to use React.AbstractComponent #16

Closed
wants to merge 2 commits into from
Closed

Conversation

SBoudrias
Copy link
Contributor

Bump to 0.89 with the new HOC helper.

@wxu-aa
Copy link
Contributor

wxu-aa commented Dec 25, 2018

Restore the TComponentC.WrappedComponent.method('foo'); ?

Then it could check the flow type for static props

@SBoudrias
Copy link
Contributor Author

Done, I had to re-adjust the type to make this case pass properly.

@SBoudrias
Copy link
Contributor Author

Actually had to remove the static types/WrappedComponent, it unfortunately didn't work in many cases :(

@wxu-aa
Copy link
Contributor

wxu-aa commented Dec 26, 2018

@SBoudrias You mean even the latest Flow doesn't support static props of HOC well? 😰
Then do we still need bump to this version?

@SBoudrias
Copy link
Contributor Author

At least now it does type validation; as previously it'd silently any type if you export translate() (any exported translated component would become any type)

@wxu-aa
Copy link
Contributor

wxu-aa commented Dec 26, 2018

@SBoudrias You mean the 3.1.5 version still type any for translated component? I checked the aa-react repo, it looks ok, return the correct type.

2

SBoudrias added a commit that referenced this pull request Dec 26, 2018
This PR is trying to reach a middle step between current status and the status of #16

By removing the second generic type, we actually add extra coverage around the locations where the context cause flow to silently set the type to `any`. (this catched 15 errors on our main repo)

And it'll allow us to easily fill in the generic type manually in order to be 100% sure the types aren't `any`. This will make it easily usable with both flow 0.84 and and 0.89.

```js
export default translate<typeof Comp>(Comp);
```
@SBoudrias SBoudrias closed this Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants