Skip to content

Files

Latest commit

 

History

History
29 lines (21 loc) · 634 Bytes

define-props-declaration.md

File metadata and controls

29 lines (21 loc) · 634 Bytes

Pattern: Inconsistent defineProps style

Issue: -

Description

This rule enforces defineProps typing style which you should use type-based or runtime declaration.

This rule only works in setup script and lang="ts".

<script setup lang="ts">
/* ✓ GOOD */
const props = defineProps<{
  kind: string,
  options: { title: string }
}>()

/* ✗ BAD */
const props = defineProps({
  kind: { type: String },
  options: { type: Object as PropType<{ title: string }> }
})
</script>

Further Reading