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
crashes on stateless react class #2179
Comments
Is this TS or Flow? |
Flow
…On Wed, Feb 27, 2019, 12:59 PM Jordan Harband ***@***.***> wrote:
Is this TS or Flow?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2179 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAdunBYZlJV1-7y4QoqZ_6_Rw0HTec5Kks5vRsdmgaJpZM4bVHVF>
.
|
I'm seeing this issue with TypeScript as well. Adding an empty State interface works around the error. |
A PR to fix both would be great. |
The number of crashes fixed in the changelog recently really illustrates the pitfalls of managing a complex codebase like this without using TypeScript or Flow |
I don’t agree; it’s just the legacy of not being rigorous about defensive programming in this repo. That’s no longer the case. |
Defensive programming is of course always good, but what I'm saying is that Flow (and I assume TypeScript?) would have caught this potential NPE before it was ever published (and probably many other type errors in this codebase). I doubt there's any programmer who's as good at remembering to include null checks as Flow is at requiring them. |
Maybe so, but that relies on the parser types always being correct too. Either way, writing not-javascript in this repo isn’t on the horizon. |
I'm getting this error:
It appears to be caused by a react class that has no state. It crashes for this code:
...but does not crash if you add a state annotation:
The text was updated successfully, but these errors were encountered: