Closed KrisBraun closed 4 months ago
I am facing the same issue. Although it works, the typescript is all fked up. Is there any workaround besides forcing the type?
Getting the same
Property 'number' does not exist on type 'ParserError<"Expected identifier at `...chapters(title, number) \n `">'.ts(2339)
"@supabase/auth-helpers-nextjs": "^0.8.7",
"@supabase/supabase-js": "^2.38.4",
import { Database } from '@/supabase'
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'
import Link from 'next/link'
export default async function UserPage() {
const supabase = createServerComponentClient<Database>({ cookies })
const { data, error } = await supabase.from('favorites').select(`
id, ...chapters(title, number)
`)
if (!data) {
return <h2>No chapters</h2>
}
return (
<>
<div className='m-auto max-w-4xl'>
<h3>favorites</h3>
<div className='flex flex-col'>
{data.map(f => {
return (
<Link href={`/chapters/${String(f.number)}`} key={f.id}>
{f.title}
</Link>
)
})}
</div>
</div>
</>
)
}
Same issue here. Any way to force the type?
Same issue here. Any way to force the type?
@arepp23 You can make a custom type and pass it .single<Type>();
or .returns<Type[]>();
:tada: This issue has been resolved in version 1.12.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Bug report
Describe the bug
Using the new PostgREST spread operator works, but leads to a Typescript error:
error TS2339: Property 'invitees' does not exist on type 'ParserError<"Expected identifier at
...contact(id,name,email,contact_user_id))">
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
...
) to aselect()
.tsc
Expected behavior
Types should successfully be generated when queries include the spread operator.
System information