typescript-vs-flowtype icon indicating copy to clipboard operation
typescript-vs-flowtype copied to clipboard

Differences between Flowtype and TypeScript -- syntax and usability

Results 25 typescript-vs-flowtype issues
Sort by recently updated
recently updated
newest added

[DRAFT] In TS you don't get "loose" properties on your objects, since you can't assign more than your definition expects: ```ts /* @flow */ type NonExact = {} const a...

```ts function test(param : Array) { return param } const compatibleVar : Array = [1, 2, 3] test(compatibleVar) ``` This [works properly in TypeScript](http://www.typescriptlang.org/play/#src=function%20test(param%20%3A%20Array%3Cnumber%20%7C%20string%3E)%20%7B%0D%0A%20%20return%20param%0D%0A%7D%0D%0A%0D%0Aconst%20compatibileVar%20%3A%20Array%3Cnumber%3E%20%3D%20%5B1%2C%202%2C%203%5D%0D%0A%0D%0Atest(compatibileVar)%0D%0A%0D%0A), but [fails in Flow](https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVUCuA7AxgFwEs5sx8BTAZ3wAoAHAQwCcGBbMALjAEEmWBPADzZMrAEbkmYAD5hqTQtgDmAPgCUYAN6owYJuXyYmpRi1aoAvulwlqYG60ZExhGOQBqzTjz4MhI8UkVMABeMABtAEYAGjAAJliAZgBddApqGgcnQhc3TyY1dCA) with the...

TS-only: - using Closure Compiler thanks to type annotations https://github.com/angular/tsickle - runtime type checking https://github.com/gcanti/io-ts Flow-only: - runtime type checking https://codemix.github.io/flow-runtime (future also possibly TS)

mention some myths: - easier to convert to when using flow - flow better with React - TS is different language vs Flow only adds typings

Some mistakes I found: `type safety` can't be `great` for both. If Flow is `great` then TypeScript should be `good`. Flow has `never` type, but it's called `empty`. `(1 +...