Skip to content

Best for JSON-types: A way to extend the Database types beyond the automatic generator

License

Notifications You must be signed in to change notification settings

activenode/supabase-table-extensions-typed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Best for JSON-types: A way to extend the Database types beyond the automatic generator

Always running supabase gen types typescript but annoyed that it cannot (it really can't because it doesn't know) derive your JSON columns? But you do know that your JSON column will always be a certain structure?

Here's the solution: An easy way to adapt the derived types and having fully typed JSON columns within your Supabase client.

How to use

The old way

  1. You generate the types at supabase.ts
  2. You import { Database } from './supabase';
  3. You instantiate a client with createClient<Database> from the previous import

The new way

  1. You generate the types at supabase.ts
  2. You copy the file supabase.extended.ts to the same directory
  3. You adapt TableExtensions to your likings
  4. You import { Database } from './supabase.extended
  5. You instantiate a client with createClient<Database> from the previous import (of the extended file, not the supabase.ts)

That's it.

You can support me

By supporting me with coffee at https://ko-fi.com/activenode and by following me on your favorite channels:

About

Best for JSON-types: A way to extend the Database types beyond the automatic generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published