79735214

Date: 2025-08-14 09:43:31
Score: 0.5
Natty:
Report link

You can make modelValue a discriminated union key by range so TS can infer the correct type automatically. For example:

type Props =
  | { range: true, modelValue: [number, number] }
  | { range?: false, modelValue: number };

Then use that type in your defineProps and defineEmits so no casting is needed.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: UncleBigBay