The dilemma with props destructure and type widening (TypeScript) #12360
ahku
started this conversation in
General Discussions
Replies: 1 comment
-
Suggestion: Vue could perhaps go the Svelte 5-route and let us define props as the value type instead of a generic argument of interface Props {
position?: 'left' | 'right'
}
const { position = 'left' }: Props = defineProps() This should be feasiable since |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With Reactive Props Destructure becoming the recommended way for reading props and settings defaults, I thought that this TypeScript issue would be more discussed but can't find anyone talking about it.
The problem is that you can now set any default values to props that you have defined without any error detection, at least not in the IDE:
I don't run any typescript checks in the terminal or any linter, so don't know if it's catched that way. But is this considered a minor issue, or is there a plan to update the API to address this?
Beta Was this translation helpful? Give feedback.
All reactions