nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.35k stars 270 forks source link

fix: use `required: false` rather than `default: undefined` for props #1450

Closed danielroe closed 2 months ago

danielroe commented 2 months ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

It feels like this might be a vue bug with prop type inference, but otherwise strange errors were occurring, e.g.:

<template>
  <NuxtImg
    v-if="uwuCookie"
    sizes="343px md:455px"
    width="455"
    height="256"
    class="mx-auto lg:my-16"
    src="/uwu.png"
    alt="Nuxt Logo in uwu style"
  />
</template>
pages/index.vue:86:9 - error TS2322: Type 'string' is not assignable to type 'undefined'.

86         sizes="343px md:455px"
           ~~~~~

https://github.com/nuxt/nuxt.com/actions/runs/10596463874/job/29364485513?pr=1650

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 61.95%. Comparing base (917242a) to head (e7de65c). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1450 +/- ## ======================================= Coverage 61.95% 61.95% ======================================= Files 79 79 Lines 3609 3609 Branches 391 393 +2 ======================================= Hits 2236 2236 Misses 1343 1343 Partials 30 30 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.