Edit: It does use Flow.
Edit: It does use Flow.
I've seen a team use typescript, but have zero types in most of their files, they just used it from libraries to get some IDE autocomplete and some very small typing on core areas.
I wish there was a plugin that just did this automatically so you could toggle it back on when done. To clarify, it's mostly when working with 3rd party/other libs, where you don't have the background of the team.
togglePanel = (newTogglePanelComponentState: Boolean) => {
return this.setState({ panelToggleState: newTogglePanelComponentState });
}
togglePanel = bool => this.setState({ panelToggle: bool })Here's a better TS implementation:
togglePanel = (panelToggle: bool) => this.setState({ panelToggle })At some point, yes, you have to use annotations to get the most of it. But, ultimately, I'd much rather trade the additional characters now for the alternative: insanity producing runtime errors in production later.
FuncA() returns T1, inferred. FuncB() expects it to return T2. Is FuncB expecting the wrong thing? Or is FuncA returning something incorrect?
Always annotating the return types fixes this. That's one area that I think inference is always risky.