electric icon indicating copy to clipboard operation
electric copied to clipboard

Document how to create and use types

Open KyleAMathews opened this issue 8 months ago • 2 comments

It's really handy to have types for e.g. useShape. There's a variety of ways you can get your db's types and we should document it.

  • common ORMs like Prisma/Drizzle generate types
  • there are tools that will generate types directly from PG — we should document one.

There's also some gotchas with at least Drizzle where by default it generates camelCase types despite the db using snake_case — so documenting the workarounds for that.

KyleAMathews avatar Apr 09 '25 12:04 KyleAMathews

Nice -- a Types guide or part of the Typescript client docs?

thruflo avatar Apr 09 '25 13:04 thruflo

Hmm good question — it could be separate as it's a pretty specific guide — also it's needed with tanstack/optimistic so it isn't directly tied to the typescript client. But a subsection of the typescript guide makes sense.

KyleAMathews avatar Apr 09 '25 13:04 KyleAMathews