Skip to content

Commit bca1992

Browse files
committed
chore(demo): generate database types from supabase cli
1 parent 9bb9e28 commit bca1992

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

demo/pages/tasks.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script setup lang="ts">
2+
import { Database } from '~~/types/database.types'
3+
24
definePageMeta({
35
middleware: 'auth'
46
})
57
6-
const client = useSupabaseClient()
8+
const client = useSupabaseClient<Database>()
79
const user = useSupabaseUser()
810
const loading = ref(false)
911
const newTask = ref('')

demo/tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "./.nuxt/tsconfig.json"
2+
"extends": "./.nuxt/tsconfig.json",
3+
"compilerOptions": {
4+
"strictNullChecks": false
5+
}
36
}

demo/types/database.types.ts

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
export type Json =
2+
| string
3+
| number
4+
| boolean
5+
| null
6+
| { [key: string]: Json }
7+
| Json[]
8+
9+
export interface Database {
10+
public: {
11+
Tables: {
12+
tasks: {
13+
Row: {
14+
completed: boolean | null
15+
created_at: string | null
16+
id: number
17+
title: string | null
18+
user: string
19+
}
20+
Insert: {
21+
completed?: boolean | null
22+
created_at?: string | null
23+
id?: number
24+
title?: string | null
25+
user: string
26+
}
27+
Update: {
28+
completed?: boolean | null
29+
created_at?: string | null
30+
id?: number
31+
title?: string | null
32+
user?: string
33+
}
34+
}
35+
}
36+
Views: {
37+
[_ in never]: never
38+
}
39+
Functions: {
40+
[_ in never]: never
41+
}
42+
Enums: {
43+
[_ in never]: never
44+
}
45+
CompositeTypes: {
46+
[_ in never]: never
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)