Closed
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 7.23.0
- eslint-plugin-vue version: 7.8.0
- Node version: 14.16.0
- Operating System: Windows 10 Pro
Please show your full configuration:
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript/recommended",
"@vue/prettier",
"@vue/prettier/@typescript-eslint",
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {},
};
What did you do?
I annotated type to array prop with typescript according to the following documentations.
- https://vuejs.org/v2/guide/typescript.html#Annotating-Props
- https://v3.vuejs.org/guide/typescript-support.html#annotating-return-types
If the prop is an array, the default should be a function, but I set empty array directly by mistake.
<script lang="ts">
import Vue from "vue";
import { PropType } from "vue";
export default Vue.extend({
props: {
foo: {
type: Array as PropType<string[]>,
default: [],
},
},
});
</script>
What did you expect to happen?
eslint reports type of the default value for 'foo' prop must be a function.
What actually happened?
eslint did not report that. If there is no type assertion, it reports correctly.
Metadata
Metadata
Assignees
Labels
No labels