Open
Description
Motivation
Is there a rule that enforces the declaration of the types for $state
? If not, is it worth doing?
Description
For consistency, we could have a rule similar to prefer-reduce-type-parameter, that clearly enforces where to define the type of a $state
variable.
Examples
<script>
// BAD
let title: string | undefined = $state();
let data: { value?: number } = $state({})
// GOOD
let title = $state<string | undefined>();
let data = $state<{ value?: number }>({});
// UNCHANGED
let label = $state(0)
</script>
Additional comments
No response