Skip to content

vue/require-valid-default-prop must be a function when using intersection #2060

Closed
@krystof-k

Description

@krystof-k

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: 8.5.0
  • eslint-plugin-vue version: 9.0.0
  • Node version: 18.7.0
  • Operating System: macOS Ventura

Please show your full configuration:

.eslintrc.cjs
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
  root: true,
  extends: [
    'plugin:vue/vue3-recommended',
    'eslint:recommended',
    '@vue/eslint-config-typescript/recommended',
    '@vue/eslint-config-prettier',
  ],
  overrides: [
    {
      files: ['cypress/e2e/**.{cy,spec}.{js,ts,jsx,tsx}'],
      extends: ['plugin:cypress/recommended'],
    },
  ],
};

What did you do?

<script setup lang="ts">
export type Dummy = 'one' | 'two' | 'three';

export type Restricted = ('one' | 'two' | 'three') & ('one' | 'three');

export interface Props {
  dummy?: Dummy;
  restricted?: Restricted;
}

withDefaults(defineProps<Props>(), {
  dummy: 'one',
  restricted: 'one',
});
</script>

What did you expect to happen?

No lint errors.

What actually happened?

I'm getting

Type of the default value for 'restricted' prop must be a function.

for the restricted prop.

Repository to reproduce this issue

Here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions