How types are inferred
| JSON | TypeScript |
|---|---|
| "text" | string |
| 42, 3.5 | number |
| true | boolean |
| null | null |
| [1, 2] | number[] |
| [{"id": 1}, {"id": 2, "tag": "a"}] | Item[] with tag?: string |
| {"user": {…}} | a separate User interface |
| [1, "a"] | (number | string)[] |
Naming
Each nested object is named after its key in PascalCase, and objects inside arrays use the singular: devices gives Device, categories gives Category. Change the root type name above, and rename the rest in your editor if a guess reads oddly.
