New Jan 3, 2025

WithDefaults() + defineProps() generates props with type any in .d.ts file

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View WithDefaults() + defineProps() generates props with type any in .d.ts file on stackoverflow.com

When I use this syntax :

const props = withDefaults(defineProps<OrionAlertProps>(), OrionAlertSetupService.defaultProps);

in my .d.ts corresponding file I get:

import type { OrionAlertEmits } from './OrionAlertSetupService';
declare const _default: import("vue").DefineComponent<any, {
    emits: OrionAlertEmits;
    props: any;
    setup: OrionAlertSetupService;
}, .....

But when I remove withDefaults I get:

import type { OrionAlertEmits } from './OrionAlertSetupService';
declare const _default: import("vue").DefineComponent<any, {
    emits: OrionAlertEmits;
    props: import("../../Shared/SharedProps").SharedPropsColor & {
        center?: boolean;
        close?: boolean;
        title?: string;
    } & {
        center: boolean;
        close: boolean;
        color: Orion.Color;
    };
    setup: OrionAlertSetupService;
}, ...

Do you have any suggestion ?

Scroll to top