You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the reproduction and have a look at the type of the val slot data property in both components.
interfaceProps<T>{val: T}interfaceSlots<T>{default: {val: T}}constAnyExample=defineComponent(// I would expect this component to use the `SlotsType` from the `SetupContext` parameter<Textendsstring>(props: Props<T>,ctx: SetupContext<{},SlotsType<Slots<T>>>)=>{return()=>h('div',[ctx.slots.default?.({val: props.val})])},{props: ['val']})
<template><!-- The `val` property here is `any`, though I would expect it to be the same type as the `val` prop => `'else'` --><AnyExampleval="else" v-slot="{ val }">
{{ val }}
</AnyExample></template>
What is expected?
When defining a component using defineComponent() with the new function signature, I would expect to be able to pass the generic types into the slots type.
I think it's related to the issue when generics stop working when the second argument of defineComponent is present
On the first screenshot everything is fine with the generic (except that props don't work)
On the second screenshot I've added a list of props, but the generic just disappeared
Luckily, there is one option available: you can put additional properties using the old way:
There is a problem here though: properties like props don't exist in the types, so you'll need to put // @ts-expect-error on those lines, plus you'll lose autocompletion based on a user defined props definition
so /pull/7963 is technically done, but I don't see any way to use this feature :c
upd: I found an issue I'm talking about: /issues/11374
Vue version
3.5.13
Link to minimal reproduction
https://play.vuejs.org/#eNrdVMFu00AQ/ZXBFwfJcYQKl+AGlaqHcqAV9a2u8NaeJC6bXWt37SaK/C98C1/G7K7juAUqxJFLYs++mX1v/Gb2wVldx22DwTxIdKGq2oBG09TAmVidZoHRWbDIRLWppTKwhxKXlcBzSe8ChYlgHcENl0anuxrp0eaeS2Fwa6CDpZIbCKl8+D4TVIXiaskKhGsla52kC9hnAqBlfA5pJrqnIFd3ANHNrOFmTiQ8HgjuMgoptIEzsbvYsk3NEU6f05zYArMZXMKjbHgJuK2xMGDWlYbiAAIjodFIUYR80JR7ET44Upf/+F4zxTZIbG31JKWqBkWpQRtVidViUluR80FrBIXZzp+0KNl3o/YlB8GLxWs47WUDKEpQAiYutp6EZdWGEdz6Q7BFY20T475DH+JJ3yJHIKZH6F57+J377yL725fvWd6GhAvv3HEmCHboq2VWvtzZ/0S7O3E+2TDRMM53FtBWJSlyBjBEdMAUTAhpgBUFau39keawQoGqKmCNisZB3reVbDTf+SxHdQ5X9w/WfUz/Ij9ErjFc0MAdv0Iy83NJQXoxSN+BGXSQ5NV0CpDaq0lA7uSgMjt3O5C3cyZ2eUTkZLNaP3d/5Rx/7w2vyclOn6XlxAwVbetzzyyH6dTfPJo2AtKisOdZAO3UiqR39xlIhN0eVvu+D5AsSp8d852uv9BiyZXD/U9c+U8MxhUIkcxGrQ0iWnxk/2W1ih+0FLQdnWOywG6LiqO6qk1F45EFtI98+Swgx8jHTy5mVIO9nShnjcW338Qf9NbGsuBaoUbVEvvhzDC1QuOPL24+07yMDjeybDihXzj8glryxnL0sI+NKIn2COfYXrq9Tv5O9YWdYH0QZYkexyULaIfbmf+T9CPdk/ht796Ouvi1RWVrUgNP4nfxm5Og+wmA2yiv
Steps to reproduce
Open the reproduction and have a look at the type of the
val
slot data property in both components.What is expected?
When defining a component using
defineComponent()
with the new function signature, I would expect to be able to pass the generic types into the slots type.What is actually happening?
The type of the generic properties in the slots is
any
, instead of the correct generic type.System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: