We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi 👋
I'm new to this and I'm trying to work with the response of find but can't get the typing right.
find
This is how I use it.
<script setup lang="ts"> import type { Page } from '@/types/page' const { find } = useStrapi() const { data: pages, pending, status, refresh, error: pagesError, } = await useAsyncData('pages', () => find<Page>('pages')) </script>
export interface PageAttributes { title: string } export interface Page { id: string attributes: PageAttributes }
So far so good. But when I try to use the response I get a type error, title does not exist on attributes of Page.
[vue-tsc] Property 'title' does not exist on type 'Page'.
<ul> <li v-for="page in pages?.data">Title: {{ page.attributes.title }}</li> </ul>
What do I need to do, so the type of Page can be used and for example the title is available to me?
Page
Thank you :)
The text was updated successfully, but these errors were encountered:
Okey, I just found my problem 😅
The issue was the Page interface. Here is the working one.
export interface Page { title: string }
Sorry, something went wrong.
No branches or pull requests
Hi 👋
I'm new to this and I'm trying to work with the response of
find
but can't get the typing right.This is how I use it.
So far so good. But when I try to use the response I get a type error, title does not exist on attributes of Page.
What do I need to do, so the type of
Page
can be used and for example the title is available to me?Thank you :)
The text was updated successfully, but these errors were encountered: