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

Type-error between this module and what Sanity exports for blocks #64

Open
isakgustavsen opened this issue May 8, 2024 · 0 comments
Open

Comments

@isakgustavsen
Copy link

When using the new export types CLI there is a conflict with what is typed here.Having looked at the type im not quite sure how to fix it, so adding an issue. Report copied from @nuxtjs/sanity where I first created the issue

Version

@nuxtjs/sanity": "^1.11.3
@sanity/client": "^6.18.0
Nuxt: 3.11.2

Reproduction

Used the new export types cli: Link

What is expected?

Types should match

What is actually happening?

Type 'BlockContent | undefined' is not assignable to type 'PortableTextBlock<PortableTextMarkDefinition, ArbitraryTypedObject | PortableTextSpan, string, string>[] | undefined'

Steps to reproduce

Export using guide and type query as described in module docs
const { data } = await useSanityQuery<Type>(query)

Additional information

Exported type looks like this:

export type BlockContent = Array<{
  children?: Array<{
    marks?: Array<string>
    text?: string
    _type: 'span'
    _key: string
  }>
  style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'blockquote'
  listItem?: 'bullet'
  markDefs?: Array<{
    href?: string
    _type: 'link'
    _key: string
  }>
  level?: number
  _type: 'block'
  _key: string
}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant