About JSON to TypeScript
TypeScript interfaces written by hand from an API response go stale quietly. The dangerous mistake is not a typo — it is marking a field required when the API sometimes omits it, because that compiles cleanly and fails only when the missing case shows up in production.
Pasting the whole array rather than one object is what prevents that. Every element is merged, so a key present in some objects and absent from others is emitted with a question mark, and a key that is null in one sample and a string in another comes out as string | null.
Keys that are not valid TypeScript identifiers — user-name, 2fa — are quoted rather than renamed, because TypeScript allows quoted property names and quoting keeps the type an exact description of the JSON.
How to generate TypeScript types
Paste your JSON
A whole array is better than one object — more samples means a more accurate type.
Name the root type
Nested objects are named automatically from the keys that hold them.
Copy the definitions
Types are emitted children first, so the file compiles in order.