Skip to content

vue/require-typed-object-prop

enforce adding type declarations to object props

  • 💡 Some problems reported by this rule are manually fixable by editor suggestions.

📖 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>
Now loading...

🔧 Options

Nothing.

🔇 When Not To Use It

When you're not using TypeScript in the project.

🚀 Version

This rule was introduced in eslint-plugin-vue v9.16.0

🔍 Implementation