Skip to content
New issue

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

chore(types): allow gerenic on Document.data #204 #204

Merged
merged 1 commit into from Jan 3, 2022

Conversation

rvieceli
Copy link
Contributor

I added the possibility to type the data inside Document, if not added, default still any.

type Post = {
  title: RichTextBlock[];
  content: RichTextBlock[];
}

const response = await prismic.query<Post>(
    [Prismic.predicates.at("document.type", "post")],
    {
      pageSize: PAGE_SIZE,
      graphQuery: `{
         post {
           title
           content
          }
        }`,
    }
  );

image

@lihbr
Copy link
Member

lihbr commented Jan 3, 2022

Hey there, thank you so much for your contribution, and sorry for the delay to get back to you! This is a great addition, I'll see to publish it quickly, code looks good to me~

If you're a TypeScript enthusiast, you might be interested in having a look at the new version of this kit (currently in beta and about to be released as latest):

@lihbr lihbr added the enhancement New feature or request label Jan 3, 2022
@lihbr lihbr changed the title Added gerenic type to Document.data (ApiSearchResponse and client met… chore(types): allow gerenic on Document.data #204 Jan 3, 2022
@lihbr lihbr merged commit 8f5f8d4 into prismicio:master Jan 3, 2022
@lihbr
Copy link
Member

lihbr commented Jan 3, 2022

Published as 5.1.1 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants