Type alias (`type Foo = {...}`) vs interface (`interface Foo {...}`) - similar but with different use cases. Type aliases support unions, intersections, and mapped types that interfaces can't. Generate either with one click; we default to interfaces but switch to type-alias mode here.
When to use this
Use type aliases when: the type uses a union (`type Status = 'idle' | 'loading' | 'done'`), an intersection (`type AB = A & B`), a mapped type (`type Readonly<T> = {readonly [K in keyof T]: T[K]}`). Use interfaces when extending object shapes (interfaces can be merged across files; types can't).
Frequently Asked Questions
Should I use interface or type alias?
For pure object shapes: either works, mostly stylistic. For unions / intersections / utility types: only `type`. For declaration-merging-friendly types: only `interface`. When in doubt, prefer `interface` for object shapes (better error messages from TS in many cases).
Powered by JSON to TypeScript.