Closed AbdallahAlhaddad closed 1 year ago
type ClrVariants = 'primary' | 'secondary' interface TooltipProps { /** * Color variant to choose from, see ... */ color?: ClrVariants text: string } const { color = 'primary', text } = defineProps<TooltipProps>()
{ // ... "meta": { "props": [ { "name": "text", "global": false, "description": "", "tags": [], "required": true, "type": "string", "declarations": [ { "file": "nuxt-proj-absoulte-path/components/Tooltip.vue", "range": [290, 302] } ], "schema": "string" }, { "name": "color", "global": false, "description": "Color variant to choose from, see ...", "tags": [], "required": false, "default": "primary", // π this field. "type": "ClrVariants | undefined", "declarations": [ { "file": "nuxt-proj-absoulte-path/components/Tooltip.vue", "range": [268, 287] } ], "schema": { "kind": "enum", "type": "ClrVariants | undefined", "schema": ["undefined", "\"primary\"", "\"secondary\""] } } ] // ... } }
If we use withDefaults it will be determined correctly
withDefaults
const { color, text } = withDefaults(defineProps<TooltipProps>(), { color: 'primary', })
Feature description:
Demo Code:
Api Response: