Skip to content

v-slots typed incorrectly in vscode and vue-tsc #5727

@blake-newman

Description

@blake-newman

Vue - Official extension or vue-tsc version

3.1.2

VSCode version

3.1.2

Vue version

3.5.22

TypeScript version

5.9.3

System Info

System:
    OS: macOS 15.7.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 1.81 GB / 48.00 GB
    Shell: 5.9 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 22.14.0 - /Users/blake.newman/.local/share/mise/installs/node/22.14.0/bin/node
    npm: 11.3.0 - /Users/blake.newman/.local/share/mise/installs/node/22.14.0/bin/npm
    pnpm: 10.11.0 - /Users/blake.newman/.local/share/mise/installs/node/22.14.0/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.123
    Safari: 26.0.1

package.json dependencies

Steps to reproduce

What is expected?

v-slots usage within JSX to be correctly typed based on the child defineSlots definition, when the component comes from a workspace package

What is actually happening?

Image

Two types seem to appear in vscode, with the latter being used.

vue-tsc also fails with same error.

The output .d.ts for this component looks like:

import { type DefineComponent } from 'vue';
type __VLS_Props = {
    example: string
};
type __VLS_Slots = {
    item?(text: string): any;
};
declare const __VLS_base: DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
    open: () => any;
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
    onOpen?: ((() => any) | undefined);
}>, {
    example: string;
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
export default _default;
type __VLS_WithSlots<T, S> = T & {
    new (): {
        $slots: S;
    };
};

The types look correct to me, although maybe there is a missing setting in DefineComponent that needs to be applied so that tsx can infer the correct type.

Link to minimal reproduction

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions