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

Wrong type when using image-url like in the example? #920

Open
silvio-e opened this issue Oct 5, 2023 · 0 comments
Open

Wrong type when using image-url like in the example? #920

silvio-e opened this issue Oct 5, 2023 · 0 comments
Labels
question Further information is requested

Comments

@silvio-e
Copy link
Contributor

silvio-e commented Oct 5, 2023

Following example from here:

import imageUrlBuilder from '@sanity/image-url'

export default defineNuxtPlugin(() => {
  const builder = imageUrlBuilder(useSanity().config) // <-- here is the problem
  function urlFor(source) {
    return builder.image(source).auto('format')
  }
  return {
    provide: { urlFor }
  }
})

Doesn't work for me as the type seems wrong:

Argument of type 'SanityConfiguration' is not assignable to parameter of type 'SanityClientLike | SanityProjectDetails | SanityModernClientLike | undefined'.
  Type 'SanityConfiguration' is not assignable to type 'SanityProjectDetails'.
    Types of property 'dataset' are incompatible.
      Type 'string | undefined' is not assignable to type 'string'.
        Type 'undefined' is not assignable to type 'string'.ts(2345)

Should this work?

@silvio-e silvio-e added the question Further information is requested label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant