withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
43.87k stars 2.29k forks source link

Error type props ts for image component #11290

Closed SavinDevelop closed 1 week ago

SavinDevelop commented 1 week ago

Astro Info

Astro                    v4.10.3
Node                     v22.3.0
System                   Linux (x64)
Package Manager          bun
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/vue
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Typescript throws an error on the props type for the image component, even though I'm doing everything as described in the documentation.

---
import image1 from '@assets/1.jpg';
import { Image } from 'astro:assets';
---
 <Image src={image1.src} alt="image" />
Type '{ src: string; alt: string; }' is not assignable to type 'IntrinsicAttributes & Props'.
  Type '{ src: string; alt: string; }' is not assignable to type 'IntrinsicAttributes & { [x: `data-${string}`]: any; title?: string | null | undefined; children?: unknown; class?: string | null | undefined; 'class:list'?: string | Record<string, boolean> | Record<...> | Iterable<...> | Iterable<...> | undefined; ... 203 more ...; inferSize?: false | undefined; }'.

What's the expected result?

I want to solve this problem

Link to Minimal Reproducible Example

None

Participation

Princesseuh commented 1 week ago

Remove .src from your code, you're using the syntax for img tags, not Image.

https://docs.astro.build/en/guides/images/#images-in-astro-files

SavinDevelop commented 1 week ago

I feel ashamed of my inattention