Describe the bug
Hi, I'm unable to test my Generic component that uses mapped types to create the slots dynamically. When I attempt to test the component using Testing Library, the mapped types are removed from the slots type, causing TypeScript errors likeObject literal may only specify known properties, and X does not exist in type Y (screen 3)
After reviewing the type definitions, I noticed that ExtractSlots uses RemoveIndexSignature which appears to remove the mapped types from the component's slots. Why is that the case?
It's worth noting that Vue Test Utils does not remove the mapped types from the slots' annotation (screen 4).
Type definition:
|
type ExtractSlots<C> = AllowNonFunctionSlots< |
|
Partial<RemoveIndexSignature<ComponentSlots<C>>> |
|
> |
To Reproduce Steps to reproduce the behavior:
I haven't prepared a reproduction case, but I can create one if needed
Expected behavior
Mapped types should be preserved in the slots' type
Screenshots
- Slots definition

- Mapped type for header slots

- Error output

- Slots type using Vue Test Utils

Related information:
@testing-library/vue version: 8.1.0
Vue version: 3.4.34
node version: 20.17.0
npm version: 10.8.2
Describe the bug
Hi, I'm unable to test my Generic component that uses mapped types to create the slots dynamically. When I attempt to test the component using Testing Library, the mapped types are removed from the slots type, causing TypeScript errors like
Object literal may only specify known properties, and X does not exist in type Y(screen 3)After reviewing the type definitions, I noticed that
ExtractSlotsusesRemoveIndexSignaturewhich appears to remove the mapped types from the component's slots. Why is that the case?It's worth noting that Vue Test Utils does not remove the mapped types from the slots' annotation (screen 4).
Type definition:
vue-testing-library/types/index.d.ts
Lines 54 to 56 in d46ed8f
To Reproduce Steps to reproduce the behavior:
I haven't prepared a reproduction case, but I can create one if needed
Expected behavior
Mapped types should be preserved in the slots' type
Screenshots
Related information:
@testing-library/vueversion: 8.1.0Vueversion: 3.4.34nodeversion: 20.17.0npmversion: 10.8.2