3 ms·
If you have a monorepo, it is pretty convenient to have synchronized Typescript definitions for communication between frontend/backend because they reference th
by trinovantes 4y ago
If you have a monorepo, it is pretty convenient to have synchronized Typescript definitions for communication between frontend/backend because they reference the same file. If you use different languages, then you'll need a translation layer/tool for shared interfaces and that can occasionally desync over time.
- rad_gruchalski 4y agoIf you use something else as a source of truth, for example generate your definitions from protobuf or openapi spec, why would it get desynchronised? I’ve done a couple of openapi-based systems recently and it’s a pretty good experience. I can generate server and client stubs next to models in various languages.
- trinovantes 4y agoNot every project needs to use protobuf or openapi. It's an overkill dependency for internal APIs to solve the problem of mismatching interfaces that's easily solved with a shared Typescript file used by both codebases.
- rad_gruchalski 4y agoAssuming that one can afford working with TypeScript on both ends, maybe. But what if you need to support other languages? brew install protobuf && some-proto-gen-wrapper.sh job done.
- johtso 4y agoEven bigger than that is reusing the same validation logic client side and server side.