Skip to content

ts error 2345 when using generics to define dynamic slots, after upgrade vue-tsc 2.2.2 to 2.2.4+ #5246

@ayrtonandino

Description

@ayrtonandino

Vue - Official extension or vue-tsc version

2.2.8

VSCode version

2.2.8

Vue version

3.5.13

TypeScript version

5.7.3

System Info

package.json dependencies

Steps to reproduce

Clone repo, go to DataTable.vue, hover over title slot to see error, this didnt happen in vue-tsc 2.2.2

What is expected?

to no show any errors on title slot, as it is defined in defineSlots

What is actually happening?

Ts error in vue-tsc ^2.2.4:
Argument of type '{}' is not assignable to parameter of type '({ title?: (() => VNode<RendererNode, RendererElement, { [key: string]: any; }>) | undefined; } & FieldsKeys<F, T>)["title"] & (() => VNode<...>) extends (props: infer P) => any ? P : {}'

This error occurs only inside DataTable.vue, when using the component everything works fine.

Link to minimal reproduction

https://github.com/ayrtonandino/vue-tsc-datatable-bug

Any additional comments?

im using this generic to check for typos when i use the datatable component, for example:

<script setup lang="ts">
  import { ref } from 'vue';
  import DataTable, { type Column } from './components/DataTable.vue'

  type Item = {
    column1: string
    column2: number
  }

  const items = ref<Item[]>([])

  const columns = [
    { key: 'column2' },
    { key: 'column1' },
    { key: 'column3' },
  ] as const satisfies Column[]
</script>
  <DataTable
    :items="items"
    :columns="columns"
  >
    <template #title>
      Table Title
    </template>

    <template #colunm3="item">
      {{ item.index }}
    </template>
  </DataTable>

Return this error: Property 'colunm3' does not exist on type '__VLS_Slots'.ts-plugin(2339).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions