3 ms·
I had the same problem and used a JSONSchema as a single source of truth. Then from that schema you can generate: - the typescript interfaces: https://www.npmj
by _bAp_ 7y ago
I had the same problem and used a JSONSchema as a single source of truth. Then from that schema you can generate:
- the typescript interfaces: https://www.npmjs.com/package/json-schema-to-typescript https://www.npmjs.com/package/json-schema-to-typescript
- the runtime checks with AJV
So you have no duplication and you're type safe.