Skip to content

Commit 4f5fe1a

Browse files
gkzmeta-codesync[bot]
authored andcommitted
[flow][docs] Add Flow for TypeScript Users comparison page
Summary: Adds a new prominent top-level page at `website/docs/flow-and-typescript.md` that serves as the canonical long-form comparison between Flow and TypeScript. Changelog: [internal] Reviewed By: marcoww6 Differential Revision: D105795128 fbshipit-source-id: cea5eaeda34ff8d582fe396730a3f8be888d1345
1 parent 4c9d572 commit 4f5fe1a

6 files changed

Lines changed: 1573 additions & 0 deletions

File tree

website/docs/faq.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,17 @@ const array = ['a', 'b']
281281
export const genericArray: Array<string> = array.map(a => a)
282282
```
283283
284+
## I'm coming from TypeScript. What's different?
285+
286+
Flow shares most of TypeScript's surface syntax — generics, conditional and mapped types, `keyof`, `unknown`, `param is T` type guards, `as const`, JSXand Flow has deliberately aligned spellings with TypeScript over the last several releases (`unknown` replacing `mixed`, `<T extends Bound>` replacing `<T: Bound>`, `as` replacing `(x: T)` casts, `readonly` / `in` / `out` replacing `+`/`-` variance sigils). The substantive divergences are deliberate Flow choices in favor of stronger static guarantees: object types are exact by default, mutable properties and arrays are invariant, methods are contravariant (not bivariant), `as` casts only widen, and type-guard bodies are validated. React is one area where the two diverge: Flow has first-class `component` / `hook` / `renders` syntax rather than modeling components through function types, `forwardRef`, and framework/library patterns.
287+
288+
See [Flow for TypeScript Users](./flow-and-typescript.md) for the full comparison, organized by what transfers cleanly, what looks the same but means something different, what only Flow has, and what only TypeScript has.
289+
284290
## See Also {#toc-see-also}
285291
286292
- [Refinements](./lang/refinements.md) — how type narrowing works and when it's invalidated
287293
- [Type Guards](./types/type-guards.md) — custom refinement functions for cases where `typeof` isn't enough
288294
- [Variance](./lang/variance.md) — why containers of subtypes aren't always compatible
289295
- [Generics](./types/generics.md) — understanding generic return types and annotation requirements
290296
- [Annotation Requirement](./lang/annotation-requirement.md) — when and why Flow requires explicit annotations
297+
- [Flow for TypeScript Users](./flow-and-typescript.md) — full TypeScript-comparison reference

0 commit comments

Comments
 (0)