Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
krystof-k opened this issue Dec 10, 2022 · 4 comments
Closed
2 tasks done

Comments

@krystof-k
Copy link

krystof-k commented Dec 10, 2022

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.

@krystof-k
Copy link
Author

krystof-k commented Dec 22, 2022

A related issue is also in @vue/compiler-sfc which is already fixed (vuejs/core#7394)!

@waynzh
Copy link
Member

waynzh commented Mar 31, 2024

Perhaps this issue has been fixed. I can't reproduce this one. 🤔

@FloEdelmann
Copy link
Member

Looks like it 🙂
I'll close this issue for now. Feel free to comment or open a new issue if the problem persists.

@krystof-k
Copy link
Author

Yeah, me neither anymore, looking fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants