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

ComponentInstance<typeof Comp>['$props'] has invalid properties when used with strictFunctionTypes and defineModel #12751

Open
bgoscinski opened this issue Jan 20, 2025 · 0 comments
Labels
language-tools related to vue language-tools scope: types

Comments

@bgoscinski
Copy link

bgoscinski commented Jan 20, 2025

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9VM1OGzEQfpXRCjUgoUQV7SVsgiCiEkWlqKS9YFqZ3UlicOyVf0KiKOeee+qp6rv1CfoIHXuXTdIk3Oz5ZvyN5/PneXJaFM2Jx6SdpDYzonBg0fkCJFfDDkucZUmXKTEutHHQ0+MCBkaPodFshU0obRzXuJsVCHOmIGZqhcpdKOu4yvAwRE+l1E+Y1+C10YWNSB3qeev0eAl8udI5xi1Ti5KbJcTKEqJlKjIGDuhscqYB1YMI0CWYarUgHgV2pL3MQWkHmVaOCwV7UBgciCnmtAg5f3//+P7n18+K4zRznsuyugM3dGEpBrM0UN029mJF445IiALg60nFtg4DTrj03CE4DW4kSo6K4HxaYOYw36CYG+S5VnIGE2HFvcQ23GstkatjqCGWaPW5yOnsdpXFkpM27AfCZcEBdLrA1ewYFvBqZbS02SoNxbcJs3HNnjeGUqgPutgQ6SGMEPi9niB1aL108IQw4rQlPNf/jWW5qkbR03RcVrZw5t3FOMBo5OwKLU1o9/x3KVGdW1f1u3TGHG4vgYR/xBm9kf5dG/q3l3ewYCptlVaIbyZ1SFU0WNoBpNEC1YihRbG0tZKQHJJj6EUNxLD5YLUiW0U7sCSjOiHRfCyc0Ipc1S6NEjAeZv8+xpzxpVVizQizxy3xBzsNMZZc03TRTEjrGnPckAAlfH5zhVNa1+BY5z68jBfAT2i19KHHMu3Mq5zaXsmL3ZImZHihhn17PnWo7POl1hq1zojMvfMqCwf2SYM6J6QsYmK0cxjrrvEsr3TUfBPr6CugST9/QCt/18qvVf5jpElOrlb4gd66TCsfdPcblYSNgxfltkjOL39I8k0Oa+Juav9tgiZMgjo6ar5tvj5KFv8AVB3gSQ==

Steps to reproduce

  1. Open the linked playground
  2. Make sure that strictFunctionTypes is set to true in tsconfig.json
  3. Hover over types in App.vue setup block

What is expected?

ComponentInstance<typeof Comp>['$props'] should evaluate to object describing Comp's props. It should not contain $-prefixed properties:

type ExpectedProps = {
    readonly visible: boolean;
    readonly "onUpdate:visible"?: (value: boolean) => any;
    key?: PropertyKey;
    ref?: VNodeRef;
    ref_for?: boolean;
    ref_key?: string;
    onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
    ... 6 more ...;
    style?: unknown;
}

What is actually happening?

ComponentInstance<typeof Comp>['$props'] evaluates to object containing $-prefixed properties such as

type ActualProps = {
    $: ComponentInternalInstance;
    $data: {};
    $props: Partial<{}> & Omit<{
        readonly visible?: boolean;
        readonly "onUpdate:visible"?: (value: boolean) => any;
    } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>;
    ... 25 more ...;
    style?: unknown;
}

System Info

Any additional comments?

Seems to be related to defineModel because the bug is not triggered when I'm not using it

@bgoscinski bgoscinski changed the title ComponentInstance<typeof Comp>['$props'] has invalid properties when used with strictFunctionTypes ComponentInstance<typeof Comp>['$props'] has invalid properties when used with strictFunctionTypes Jan 20, 2025
@bgoscinski bgoscinski changed the title ComponentInstance<typeof Comp>['$props'] has invalid properties when used with strictFunctionTypes ComponentInstance<typeof Comp>['$props'] has invalid properties when used with strictFunctionTypes and defineModel Jan 20, 2025
@jh-leong jh-leong added the language-tools related to vue language-tools label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-tools related to vue language-tools scope: types
Projects
None yet
Development

No branches or pull requests

2 participants