Also you can't really hand a third party a typescript interface and tell them to conform with that.
And finally, I would imagine a good schema could enforce more things like the length of identifiers, whether a number can be negative, etc.
That's mostly true, but some projects exist that allow a subset of interfaces to be used at runtime:
- https://github.com/gcanti/io-ts
- https://github.com/fabiandev/ts-runtime
- https://github.com/codemix/flow-runtime
- Or just manual assertions: https://gist.github.com/JohnWeisz/beb7b4dadc512be30ce6c7c1e4...
Also you can't really hand a third party a typescript interface and tell them to conform with that.
And finally, I would imagine a good schema could enforce more things like the length of identifiers, whether a number can be negative, etc.