website/docs/glossary.md
A short glossary of Flow terminology. Each entry is a one-sentence definition followed by a link to the full reference page. Where helpful, an entry also notes how the concept relates to a similar one in TypeScript.
typeof, instanceof, equality, or a type guard. See Type Refinements.?T) — Flow shorthand for the union T | null | void, used to express values that may be absent; TypeScript has no direct equivalent and typically writes T | null | undefined (more). See Maybe Types.... (e.g. {foo: number, ...}) that allows additional unknown properties beyond those listed; TypeScript object types are open by default and have no syntactic inexact marker (more). See Exact and inexact object types.... (e.g. {...A, b: T}), producing a new object type that combines A's properties with the additional members, mirroring runtime object spread; TypeScript has no type-level spread and uses intersection (A & {b: T}) instead (more). See Object type spread.[key: K]: V that allows reads and writes for any key whose type matches K and any value whose type matches V, used to type objects that are used as maps. See Objects as maps.{type: 'A', value: number} | {type: 'B', error: string}) that each set a different literal type for a shared discriminant property, letting Flow refine the union to a specific arm by checking that property. See Disjoint Object Unions.as cast can forge a branded value (more). See Opaque Type Aliases.never (more). See Empty.#private fields, private/protected modifiers, unique symbol) (more). See Nominal & Structural Typing.implies) — A predicate function whose return type is implies param is T, which refines the parameter to T only when the function returns true and leaves it unchanged otherwise; this has no TypeScript equivalent (more). See Type Guards.obj.method without calling it, destructuring it, or .bind()-ing it), since doing so would lose the this type that the method depends on; TypeScript treats methods as plain function values and lets the same extraction through silently (more). See Method unbinding.in T / out T on type parameters, readonly / writeonly on properties — but Flow's variance rules are stricter at several places (mutable properties, mutable arrays, method parameters, generic type arguments) (more). See Input and Output Positions.import typeof — A Flow-specific import form that brings in the type of a value export from another module so it can be used as a type annotation; TypeScript's nearest analogue is typeof import('./m')['Foo'] with a different binding shape (more). See Module Types..js.flow) — A .flow file placed next to a .js implementation that completely shadows the implementation's types when Flow is checking code; TypeScript's .d.ts covers both this case and the third-party-package case that Flow handles via libdefs (more). See Declaration Files.flow-typed/ that declares the type signature of a third-party module Flow cannot type-check directly; TypeScript's equivalent is @types/* packages and package-level .d.ts files (more). See Library Definitions.[signature-verification-failure] error refers to when it cannot do so; TypeScript has no equivalent and infers exports across module bodies (more). See Module Exports.component) — A first-class Flow keyword for declaring React components with named props, optional ref, and render-type support, replacing hand-written function-component types; TypeScript has no built-in component syntax and models the equivalent shape with function types (more). See Component Syntax.component(...)) — The type-level form of Component Syntax, used to describe the type of a React component (especially in libdefs and HOCs) without defining one. See Component Types.renders) — A type that constrains what a component is allowed to render, enabling library authors to enforce composition rules like "a Menu only renders MenuItems"; TypeScript has no built-in render-constraint type (more). See Render Types.hook) — A first-class Flow keyword for declaring React hooks, which lets Flow enforce the Rules of React on hook call sites; TypeScript has no equivalent and relies on ESLint (eslint-plugin-react-hooks) to enforce hook rules without type information (more). See Hook Syntax.enum along several axes (exhaustiveness, coercion, default values, reverse mapping, member iteration, symbol enums) (more). See Flow Enums.match (...) { pattern => ... } construct that pattern-matches a value with structural patterns, guards, and exhaustiveness checking; TypeScript has no match, and the closest statement-form analogue is a discriminated-union switch with an assertNever fallthrough — there is no expression-form analogue at all (more). See Match Expressions and Statements.match and by switch over Flow Enums, or on demand for arbitrary switch statements by casting the default branch to empty.@flow pragma — A // @flow comment at the top of a file that, by default, opts that file into Flow type checking. See Getting Started.@flow strict / @flow strict-local) — A file-level pragma that turns on a configurable set of stricter lint rules (banning any, etc.) on a per-file basis; the more common @flow strict-local variant is the same but does not require dependencies to also be strict. See Flow Strict.$FlowFixMe[code]) — A comment placed immediately above a Flow error that silences that specific error code without fixing the underlying issue, used when Flow is too conservative or a fix is deferred. See Error Suppressions.sketchy-null, untyped-import) on top of regular type errors. See Linting Overview.