Skip to content

Carousel, Galleria, Timeline: value generic type not inferred in slots #8487

Description

@YevheniiKotyrlo

Describe the bug

Carousel, Galleria, and Timeline components use any for their value arrays and slot scoped data. This means:

  1. Carousel #item slot's data parameter is any
  2. Galleria #item / #caption / #thumbnail slot's item parameter is any
  3. Timeline #content / #opposite / #marker / #connector slot's item parameter is any

With a generic T parameter, TypeScript can infer the item type from the value binding and flow it to all slots.

Same root cause as #8442DefineComponent uses a no-arg constructor that prevents generic inference.

Reproducer: StackBlitzbun run type-check (0 errors, typo undetected) → bun run patch && bun run type-check (TS2339 catches it)

Reproducer

<Carousel :value="products">
  <template #item="{ data }">
    {{ data.name }}  <!-- data: any — no autocomplete -->
  </template>
</Carousel>

Pull Request Link

#8490

PrimeVue version

4.5.4

Vue version

3.5.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

N/A (type-level issue)

Steps to reproduce the behavior

  1. Pass a typed array to Carousel value, Galleria value, or Timeline value
  2. Use the #item, #content, or related slot
  3. The slot parameter is typed as any instead of the array element type

Expected behavior

data should be inferred as the element type of the value array (e.g., Product).

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypescriptIssue or pull request is *only* related to TypeScript definition

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions