Skip to content
Discussion options

You must be logged in to vote

Vue isn't filling in your optional props — but there's a detail that makes it look exactly like it is.

On 3.5.40, a wrapper declaring name, inputDir?, inputProps? and mask?, rendered with only name passed:

props.inputProps       = undefined
props.inputDir         = undefined
props.mask             = undefined
props.inputProps?.type = undefined

'inputProps' in props  = true      <-- this is the confusing part

Every omitted prop is undefined. Nothing was invented from the TypeScript types. But the key is present on the props object, because defineProps<Props>() declares all four props at runtime — declared and unset, not absent. So 'inputProps' in props is true, Object.keys(props) include…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Nik3iw
Comment options

You must be logged in to vote
1 reply
@lMysticl
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants