8 ms·
Imagine creating this beast of a "framework" and not even using TypeScript or Flow. What are you thinking? Edit: It does use Flow.
by d357r0y3r 7y ago
Imagine creating this beast of a "framework" and not even using TypeScript or Flow. What are you thinking?
Edit: It does use Flow.
- miksuv 7y agoIt does use Flow.
- mmckelvy 7y agoSigh. I really wish people would just accept the fact that JavaScript is a dynamically typed language and stop making things unnecessarily difficult.
- d357r0y3r 7y agoTo people who understand what static typing does and the problems it solves, this statement is the equivalent of "Hitler did nothing wrong."
- codr7 7y agoYou're ignoring the fact that many already went through that phase and ultimately decided that complexity is the only enemy worth fighting in software. It always pays off to take a closer look at the things you can't think or say, to ask why.
- d357r0y3r 7y ago> You're ignoring the fact that many already went through that phase and ultimately decided that complexity is the only enemy worth fighting in software. No, this doesn't match my experience. The people who resist types are usually web designer types who haven't actually worked with type systems at all so they view it as ivory tower nonsense - complexity for complexity's sake. There is the occasional person who worked with Java in college and hated it, and assumes that every language with types is just a variation on Java. This is, of course, not a very informed position.
- lhorie 7y agoPersonally, I've worked with both Flow and Typescript, plus Java, C# and Actionscript professionally, and C, C++, D, and Rust for fun (and also Ocaml, SML and Haskell to a lesser degree). And I still choose to write plain JS sometimes for various reasons. I have many co-workers with several years of work experience who share caution against static typing kool-aid. Anyone that pits types vs no types as if it's some sort of competition or some elitism thing is probably forgetting to consider that there are in fact perfectly valid scenarios where one is more suitable than the other (and vice versa)
- codr7 7y agoI've been writing code on a daily basis for over 30 years; in umpteen different languages, some more typed than others. And I'm still not very fond of having types shoved down my throat, nor any other kind of restrictions. We've been building computers and writing code for quite some time now, so long that some of us are beginning to notice the repetitions. The fact that experience is so often dismissed begins to explain the mess we're in.
- saagarjha 7y agoGodwin's law strikes again. Static typing is great, don't get me wrong, but it's not always the right solution. There are cases where runtime flexibility can be useful.
- eropple 7y agoTypeScript isn't statically typed, though. I make sure to keep my type boundaries clean but I haven't shied away from dropping into `any` if it was faster to express. I did then get better at TypeScript over time and remove most of those cases, though.
- Klathmon 7y agoThat's why I love Flow and Typescript so much. They are as opt-in as you want them to be. 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.
- sbr464 7y agoMy only issue is TS usage with extremely large/complex components/containers. For example, files around 500 lines of code, I've temporarily removed TS, done a few other optimizations (ternaries for obvious If/Else statements, etc) to reduce to ~200-230 lines total. The file is instantly easier to reason about and modify. 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.
- sbr464 7y agoBasically a complex version of this example, done over and over, for larger methods. togglePanel = (newTogglePanelComponentState: Boolean) => { return this.setState({ panelToggleState: newTogglePanelComponentState }); } togglePanel = bool => this.setState({ panelToggle: bool })
- paavohtl 7y agoI don't understand what you're trying to demonstrate with your example. Your TS(?) example is needlessly complicated, and syntactically invalid. Here's a better TS implementation: togglePanel = (panelToggle: bool) => this.setState({ panelToggle })
- sbr464 7y agoI agree, it wasn't a good example. More was (attempting) to make a point when inside a complex file, what I've seen. With long interface names mixed in with long variable names, contributing to larger files sizes than necessary. It varies depending on project/company. It's lowercase `boolean`.
- paavohtl 7y agoYou're right, sorry! I write TS every day at work but for some reason I sometimes forget which languages use bool and which use boolean ;)