Performance: Typing composables
LOW IMPACT
Typing composables affects the development experience and bundle size, indirectly influencing load speed and runtime performance.
import { ref, Ref } from 'vue'; export function useCounter(): { count: Ref<number>; increment: () => void } { const count = ref(0); function increment() { count.value++; } return { count, increment }; }
import { ref } from 'vue'; export function useCounter() { const count = ref(0); function increment() { count.value++; } return { count, increment }; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Untyped composable | 0 | 0 | 0 | [OK] Good for runtime but risky for dev |
| Typed composable | 0 | 0 | 0 | [OK] Good for dev experience, no runtime cost |