How to implement interface for table?
Say I have an interface of User
and this is how I declare my schema
How do I make sure that the user table implement the User interface that I have declared?
4 Replies
Why do it the other way?
You can first declare schema and be it your interface with
maybe he has shared interface for client and server
This, Iām working in a monorepo where I have a module for Web, one for API and one for shared interface. The workflow is I first create an interface in the shared interface module then use it in both web and api modules. This way I can make sure the api returns the correct type for the web.
@nqhtrung I'm not sure if this is what you are looking for, but the types in here might be helpful for you: https://github.com/digidem/mapeo-core-next/blob/981070acfd22ca68d4537f666749bccc5ef033dc/lib/schema/schema-to-drizzle.js (they might not be completely correct - this is an in-progress PR)
GitHub
mapeo-core-next/lib/schema/schema-to-drizzle.js at 981070acfd22ca68...
The upcoming version of Mapeo Core. Contribute to digidem/mapeo-core-next development by creating an account on GitHub.