Description
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
<script lang="ts">
/* ✓ GOOD */
interface Props {
a: string;
b: number;
}
let { a, b }: Props = $props();
/* ✗ BAD */
interface Props {
a: string;
b: number;
}
let { a }: Props = $props();
</script>
Additional comments
No response