fauna / fauna-js

Javascript driver for Fauna v10 (current)
https://fauna.com
Other
37 stars 7 forks source link

Typescript: Property 'after' does not exist on type 'QuerySuccess<Page<T>>' #291

Closed tbdsux closed 1 month ago

tbdsux commented 1 month ago

Property 'after' does not exist on type 'QuerySuccess<Page>'

image

I found the use of Page<T> from: https://github.com/fauna/js-sample-app

const res = await client.query<T>(query)

res.after // type error: 'Property 'after' does not exist on type 'QuerySuccess<T>''

Checking the types: QuerySuccess does not have after field while Page has after

UPDATE: After more trying, seems to be the return types are just correct. I thought .after was available without having to use Page<T> like: res.after

const res = await client.query<Page<T>>(query) // need to use Page<>

res.data.data // data
res.data.after // nextToken
ptpaterson commented 1 month ago

Hi @tbdsux You nailed it! Thank for the submission. Please don't hesitate to reach out if you catch anything else.