YAML to TypeScript Converter
Convert YAML to TypeScript online, for free. This tool infers a TypeScript interface or type alias directly from the shape of your YAML data, whether it's saved as .yaml or .yml — handy for typing configuration files or API fixtures without writing types by hand.
Drop your YAML file here
or
Supports .yaml and .yml files, processed entirely on your device
YAML →JSON
Your converted output will appear here.Conversion notes
What to expect
- Nested mappings become nested inline object types.
- Lists of objects produce a RootItem interface plus a Root array type.
- Mixed-type arrays are typed as a union of the observed element types.
Example
site:
name: Aperture Docs
version: 1.4.2
active: true
tags:
- web
- cli
- tools
author:
name: Jane Doe
email: jane@example.com
export interface Root {
site: {
name: string;
version: string;
active: boolean;
};
tags: string[];
author: {
name: string;
email: string;
};
}
YAML to TypeScript Converter FAQ
Does this infer optional fields?
Fields whose YAML value is null are marked optional with a `?`, since the field's presence can't be confirmed from a single sample.
What if my YAML is a list at the top level?
The tool generates a RootItem interface from the first item's shape, then exports Root as RootItem[].
Can I rename the generated interface?
Yes, copy the output and rename "Root" or "RootItem" to whatever fits your codebase.
Is there a difference between .yml and .yaml?
No. ".yml" and ".yaml" are just two file extensions for the exact same format — this converter accepts either one, so a "yml to TypeScript" conversion and a "yaml to TypeScript" conversion produce identical results.