Description
Please describe what the rule should do:
Rule should throw error/warning when component has declared prop without TypeScript definition
What category should the rule belong to?
[ ] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[x] Other: Increase type coverage
Provide 2-3 code examples that this rule should warn about:
<script lang="ts">
export default {
props: {
total: {
type: Object, // Error
required: true,
},
},
};
</script>
<script lang="ts">
export default {
props: {
total: {
type: Object as PropType<Price>, // OK
required: true,
},
},
};
</script>
Additional context
Since defineComponent
from vue-next
or @vue/composition-api
TypeScript compiler understands how properties of this
are typed. However there's no way to force writing type definition of props (other than noImpliciteThis
in the tsconfig
). Rule like this can improve TypeScript migrations.
Please let me know what you think about it. If you like this idea I can implement this rule.