Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.27 KB

require-typed-object-prop.md

File metadata and controls

53 lines (37 loc) · 1.27 KB
pageClass sidebarDepth title description
rule-details
0
vue/require-typed-object-prop
enforce adding type declarations to object props

vue/require-typed-object-prop

enforce adding type declarations to object props

  • This rule has not been released yet.

📖 Rule Details

Prevent missing type declarations for non-primitive object props in TypeScript projects.

<script lang="ts">
export default {
  props: {
    // ✗ BAD
    bad1: Object,
    bad2: { type: Array },
      
    // ✓ GOOD
    good1: Object as PropType<Anything>,
    good2: { type: Array as PropType<Anything[]> },
    good3: [String, Boolean], // or any other primitive type
  }
}
</script>

Options

Nothing.

🔇 When Not To Use It

When you're not using TypeScript in the project.

📚 Further Reading

Nothing

🔍 Implementation