Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defineComponent had type error #8608

Open
mengdaoshizhongxinyang opened this issue Jun 20, 2023 · 2 comments
Open

defineComponent had type error #8608

mengdaoshizhongxinyang opened this issue Jun 20, 2023 · 2 comments

Comments

@mengdaoshizhongxinyang
Copy link

Vue version

3.3.4

Link to minimal reproduction

https://www.typescriptlang.org/play?ssl=7&ssc=2&pln=1&pc=1#code/JYWwDg9gTgLgBAbzgEwKYDNgDtUGELgQ5YwA0AFqQMqowCuY+JqAHmVQDYQwDOAKgE8wqOAF846KATgAiAG51UMgFABjIj3j5wAXjSYc2yMRgAKZXEtwA9NZhCRqKFKgWrpsFLA8AXAlGkqjAsPjT0jEQwrDAAPADaALrUXLyCwjEI6BAQPppQ2ADmogB8xQCUOsUIblZWULR0UFhwphXF5KYA5MjAcp1lNWLKZUA

Steps to reproduce

//

What is expected?

//type error
defineComponent(
    (props:{},ctx:SetupContext<[],SlotsType<{foo:string}>>)=>{
        return ()=>h('div')
    }
)

What is actually happening?

Type '{ attrs: Data; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: (exposed?: Record<string, any> | undefined) => void; }' is not assignable to type '{ attrs: Data; slots: Readonly<{ foo: Slot<string>; }>; emit: (event: never, ...args: any[]) => void; expose: (exposed?: Record<string, any> | undefined) => void; }'.

System Info

No response

Any additional comments?

No response

@Shyam-Chen
Copy link
Contributor

@pikax
Copy link
Member

pikax commented Feb 12, 2024

Closing this, explanation here

TLDR: This is just type usage but there's need for the runtime information to also be provided, since the usage from the docs is not being followed, this is not an error or bug.

@pikax pikax closed this as completed Feb 12, 2024
@pikax pikax reopened this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants