nuxt / nuxt/image

TypeScript error on useImage provider option with v2.0.0

Open
#2,036 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

The TypeScript definition of the function yielded by useImage has changed and now causes typing errors when willing to use its provider option.

That option was typed as string, but is now typed as only 'ipx'.

The ImageOptions seems to have been changed for listing the configured providers there. But for some reason, that does not work in my project.

I have not found something about this in the migration guide. (By the way, the link to this guide in the release note is broken.)

What am I missing?

image config in nuxt.config:

  image: {
    strapi: {
      baseURL: process.env.NUXT_PUBLIC_CMS_BASE_URL
    },
    cloudflare: {
      baseURL: process.env.NUXT_PUBLIC_ASSETS_BASE_URL
    }
  }

Nuxt version 3.16.2. previous nuxt/image version 1.11.0.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the useImage documentation and the ImageOptions type involved in provider configuration, using the reported nuxt.config example to reproduce the TypeScript error. Compare the v1.11.0 and v2.0.0 behavior and check the migration guide and v2.0.0 release note; done means configured providers can be used without the reported typing error and the migration documentation is accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.