You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule aims to ensure consistency between the defined Props type and the actual use of $props().
This prevents mistakes due to overlooking properties and improves code readability and maintainability.
Enforcing this rule helps developers understand and reduces the risk of potential bugs.
Description
Issue a warning if the type of the defined Props does not match the variable destructuring assignment in $props().
Examples
<scriptlang="ts">
/* ✓ GOOD */interfaceProps { a:string; b:number; }let { a, b }:Props=$props();/* ✗ BAD */interfaceProps { a:string; b:number; }let { a }:Props=$props();
</script>
Additional comments
No response
The text was updated successfully, but these errors were encountered:
Thank you for proposing the rule!
That rule sounds good to me!
If possible, it would be even better if it could check the usage of unnamed props as well.
<scriptlang="ts">
interfaceProps { a:number; [key:string]:unknown; // unused }let {a}:Props=$props();// We can guess that the following would be correct:// let {a, ...other}: Props = $props();
</script>
And it would be even better if the rule could check member access as well.
Motivation
This rule aims to ensure consistency between the defined
Props
type and the actual use of$props()
.This prevents mistakes due to overlooking properties and improves code readability and maintainability.
Enforcing this rule helps developers understand and reduces the risk of potential bugs.
Description
Issue a warning if the type of the defined
Props
does not match the variable destructuring assignment in$props()
.Examples
Additional comments
No response
The text was updated successfully, but these errors were encountered: