pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/require-typed-object-prop |
enforce adding type declarations to object props |
v9.16.0 |
enforce adding type declarations to object props
- 💡 Some problems reported by this rule are manually fixable by editor suggestions.
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>
Nothing.
When you're not using TypeScript in the project.
This rule was introduced in eslint-plugin-vue v9.16.0