I am the only one who is happy to code without static typing? Enjoying fast compilation, small, fast editors, flexibility. I don't really make stuff like marry(a, b) and then call it with a banana and an apple by accident. Sure I make plenty of mistakes when I am coding but only very few could have been caught by a static type check. Take one of the examples in the slides: let obj: string; obj = 'yo'; // Error: Type…
Flow vs. Typescript
101–110 of 158 posts
Re: Flow vs. Typescript
#102Earlier quoted context omitted.
> This means I can just write JavaScript and add comments for types. No transplier step, no messing around in a different but similar language, no additional complexity, just easy. Can't you do the same thing with TypeScript's typings?
No. With flow you can do both: var x /*: string*/ = "" var x : string = "" With TS you can only do the latter. The first one has the advantage that it's legal Javascript, thus not requiring a compiler. Since typescript is set-up purely as a compiler anyway I'm not sure it would be a useful feature for them. A disadvantage could be that it's easier to make silent errors by making syntax errors in the comments. I don't…
For example:
/**
* @param {string} a
* @param {number} b
* @returns {string}
*/
function foo(a, b){
return a + b;
}
Is functionally identical to: function foo(a: string, b: number): string {
return a + b;
}
See: https://github.com/Microsoft/TypeScript/issues/4790Re: Flow vs. Typescript
#103Earlier quoted context omitted.
I talked with Lee Byron about the differences and if there's hope for convergence at React Europe. He said: - the biggest difference is nullability (you have to explicitly set TypeScript to treat all types as non-nullable by default to get behavior similar to Flow's default). - Flow uses nominal typing (similar to functional languages); whereas, TypeScript uses structural typing (similar to Java). To be honest, I don…
I have the opposite impression. Structural type systems feel like dynamic typing most of the time, especially with JavaScript in mind (many {} and [] etc.)
Re: Flow vs. Typescript
#104Earlier quoted context omitted.
> no messing around in a different but similar language TypeScript would be a disaster if it subtly changed the semantics of JavaScript. It doesn't, though. It's a superset, so it's really not a "different but similar" language. It's the same language with more features, and the compiler is a great guide to using those features.
You mean like how it breaks ES6 classes semantics by making members enumberables? Whoops (I know, if you look at my comment history I used that example all the time...but it's just such an easy one). When comes the time to pick between shinier output and correctness, TypeScript is perfectly happy to diverge from JavaScript, until it really has no choice (eg: when it moved to ES6 modules)
Edit: This is seriously driving me nuts that I can't find anything about it. I hope you see this and respond because I'm incredibly curious!
Re: Flow vs. Typescript
#105First, the slides about lack of non-nullable types in TypeScript are incorrect, if you count the beta ("next") versions. It's already part of 2.0 [1] which should be out soon [2]. He says "there is hope" but it's more than hope, it's a certainty. (the date of the presentation is not clear, but seems outdated to me)
Second, there's a lot of other features that are left out. Union types, flexible interfaces, etc. They're not on par between the two languages, but many of those are almost as helpful as types, just more specific, so they're important if one is trying to draw a comparison.
Re: Flow vs. Typescript
#106I like very much the last slide and the author's recommendation. Helpful and better than the admonitory 'yes you should use typed JS': - if your project does not live for long: no - if your project is really simple: no - if there is a chance you will need to refactor the thing: yes - if your system is very important or even crucial for the success of your company: yes - if people enter or leave your team frequently:…
> - if people enter or leave your team frequently: yes Interesting, I would put that one as a no, since introducing TS to you project means longer time train new employees. On the other hand it will make sure their commits break something less often, so not so sure about this one
On the other hand, giving them constraints (because of the type system) ensures their work is not breaking stuff along the way as they learn the ropes of the code base.
From my perspective, setting up a build flow (dependencies, etc) is the biggest problem with TypeScript projects. If you assume that's already done in a given project, then the negative impact is gone and TypeScript only makes it easier.
Re: Flow vs. Typescript
#107The main problem for me, is that Flow doesn't support Windows (yet?). I've been working solo on a frontend a couple of months now, and the team has just been extended with a new developer (yay). However, he uses Windows, and so all my type annotations are worthless. We're making the switch to TypeScript once 2.0 is released (easier to port with strictNullChecks).
Really wondering: who is developing Node/JS on Windows nowadays? Not that I don't like Windows (I like W10 + the new Ubuntu within efforts a lot), but the ecosystem around Node is so much tailored around Linux. Even with OSX where we have an excellent support, there's still some slight friction when deploying to Ubuntu. Or is Windows 10 a viable alternative for Node devs?
Once the next Windows 10 update makes bash available to everyone, though, that'll become a non-issue.
Re: Flow vs. Typescript
#108The main problem for me, is that Flow doesn't support Windows (yet?). I've been working solo on a frontend a couple of months now, and the team has just been extended with a new developer (yay). However, he uses Windows, and so all my type annotations are worthless. We're making the switch to TypeScript once 2.0 is released (easier to port with strictNullChecks).
Really wondering: who is developing Node/JS on Windows nowadays? Not that I don't like Windows (I like W10 + the new Ubuntu within efforts a lot), but the ecosystem around Node is so much tailored around Linux. Even with OSX where we have an excellent support, there's still some slight friction when deploying to Ubuntu. Or is Windows 10 a viable alternative for Node devs?
In this case, however, it nicely integrates into our existing windows infrastructure.
I haven't found any reason to recommend against deploying node on windows. To this point it has just worked.
Re: Flow vs. Typescript
#109From my experience - Flow is still very "unstable" and in heavy development. I haven't tried TypeScript at all, so I cannot compare that. It's absolutely true that Flow team is merging all pull good requests, fixing issues (the backlog is big - 500 issues - but TypeScript has 1000, so it's not incomparable) and the system is made dramatically better every release. But there are still rough edges, especially when work…
The GitHub community is going really fast, and I love reading some of the PRs, but it's hard for me to compare in that sense.
Re: Flow vs. Typescript
#110I am the only one who is happy to code without static typing? Enjoying fast compilation, small, fast editors, flexibility. I don't really make stuff like marry(a, b) and then call it with a banana and an apple by accident. Sure I make plenty of mistakes when I am coding but only very few could have been caught by a static type check. Take one of the examples in the slides: let obj: string; obj = 'yo'; // Error: Type…