Flow to TypeScript Declaration Converter
Paste Flow-annotated source to generate a matching TypeScript declaration file, converting type aliases, interfaces, and function signatures. Free online developer tool.
Paste Flow Source
TypeScript Declaration
TypeScript declaration output will appear here...
Free Flow to TypeScript Declaration Converter
Paste Flow-annotated source to generate a matching TypeScript declaration (.d.ts-style) file — type aliases, interfaces, and function signatures are converted to their TypeScript equivalents so you can drop the shapes straight into a .d.ts file or a type-only import.
How to Use It
Paste any Flow-annotated source into the input box, or click "Load Example." The tool parses your code with Flow's own parser, walks every top-level type alias,interface, and function declaration, and prints a TypeScript equivalent for each one — object types, unions, arrays, nullable (?T) types, and function signatures all map to their closest TypeScript form.
Example
Given type Address = { city: string, zip?: string } and afunction greet(name: string, address: Address): string declaration, the tool emits a TypeScript type Address = { city: string; zip?: string; } plus adeclare function greet(name: string, address: Address): string; ambient declaration.
Common Use Cases
- Producing a starting-point
.d.tsfile when porting a Flow-typed library to TypeScript. - Quickly converting a single Flow type alias or interface without setting up a full build pipeline.
- Checking how a Flow type shape maps onto TypeScript syntax during a gradual migration.
FAQs
Is this an exact, byte-for-byte conversion?
No — this is a best-effort structural conversion. It handles the most common Flow constructs well (object types, optional and nullable fields, unions, arrays, tuples, interfaces, and function signatures), but it's a hand-built mapping rather than an official, fully-specified Flow-to-TypeScript compiler. Less common constructs — object spreads inside a type, exact/inexact object semantics, bounded or defaulted generics, and Flow utility types like $Diff or $Shape— are simplified, approximated, or left as any rather than causing the tool to fail. Review the output before relying on it for anything nontrivial.
Why does it only convert some declarations and skip others?
Only top-level type aliases, interface declarations, and function declarations are converted — runtime-only code like variable assignments or class implementations is intentionally skipped, since a declaration file describes shapes, not runtime behavior.
Is my code uploaded anywhere?
No — parsing and conversion happen entirely client-side in your browser, using Flow's parser loaded on demand. Nothing you paste is sent to a server.
