News for hackers. Stuff that matters.
Re:TypeScript vs. ReasonML by ryanar on Wednesday September 04, 2019 @11:53AM (#20878403)
Flow engineers communicated a few months back to the community saying that they do care, they just were a small team working on the project and had pressing issues at FB to solve first. They mentioned that Flow was really slow for the large-scale projects that existed at FB and so performance was the immediate concern and that ate a year of time after they open sourced the project.
Re:TypeScript vs. ReasonML by pknopf on Wednesday September 04, 2019 @12:10PM (#20878585)
Sounds like it's on life support.

Nobody should be using Flow.

Re:TypeScript vs. ReasonML by kevinb7 on Wednesday September 04, 2019 @12:19PM (#20878665)
This really depends on what you care about. Flow is much better at ensuring type safety in your code while TypeScript has some pretty glaring holes in this respect. In particular, TypeScript allows covariant assignment and param passing which makes it really easy to write unsafe code.
Re:TypeScript vs. ReasonML by Arnavion on Wednesday September 04, 2019 @12:35PM (#20878847)
The covariant param passing was fixed some time ago with the (now on-by-default) `strictFunctionTypes` option. Eg `function f(cb: (_: Animal) => void) { cb(new Dog()); }` can no longer be used as `function takes_cat(_: Cat) { } f(takes_cat);`

Assignment is still there though (ie you can still assign a `Cat[]` to an `Animal[]` and push a `new Dog()` into it).

Re:TypeScript vs. ReasonML by kevinb7 on Wednesday September 04, 2019 @07:00PM (#20882217)
I believe that `strictFunctionTypes` only applies to callbacks. TypeScript is okay with the following code even with that option turned on:

  class Animal {}
  class Cat extends Animal { meow() {} }
  class Dog extends Animal { woof() {} }

  function foo(animals: Animal[]) {
    animals.push(new Dog)
  }

  const cats: Cat[] = [new Cat];

  foo(cats);
https://www.typescriptlang.org/play/#code/MYGwhgzhAECCB2BLAt...
Re:TypeScript vs. ReasonML by Arnavion on Thursday September 05, 2019 @01:51AM (#20884183)
Your example is identical to the case I covered in the second paragraph of my comment. ie your code compiles because it is legal to assign a `Cat[]` to an `Animal[]`, as I said.

When you mentioned "covariant param passing" I assumed you were referring to the long-lasting issue about callbacks, hence my original comment mentioning that that issue has been fixed. It's not useful to differentiate between "assigning a value to a variable of a certain type" and "passing a value to a function parameter of a certain type" because those are identical.