Enforce strict typing and consistent handling of component props and events to ensure type safety, runtime validation, and maintainable component interfaces. Key guidelines:

  1. Always declare prop types explicitly with runtime validators:
    export default {
      props: {
     value: {
       type: Number,
       required: true,
       validator: (val) => val >= 0
     },
     options: {
       type: Array,
       default: () => [] // Use function for object/array defaults
     }
      }
    }
    
  2. Use typed emits declaration to enable proper type checking:
    export default {
      emits: {
     'update:modelValue': (value: number) => value >= 0,
     'change': (value: number, oldValue: number) => true
      }
    }
    
  3. Maintain consistent event naming:
  4. Validate props access:

This ensures components are type-safe, self-documenting, and maintainable while preventing common runtime errors.