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

Directive type definition has wrong "modifiers" definition #12604

Open
ludwig801 opened this issue Dec 24, 2024 · 0 comments · May be fixed by #12605
Open

Directive type definition has wrong "modifiers" definition #12604

ludwig801 opened this issue Dec 24, 2024 · 0 comments · May be fixed by #12605

Comments

@ludwig801
Copy link

Vue version

3.5.12

Link to minimal reproduction

https://play.vuejs.org/#eNp9UctOwzAQ/JWVLwGppILCpUor8agEiAKCHi2hkm6LS2Jb9iYUhfw7a5c+DqiHRPbM7Hp2pxGX1qZ1haIvMsLSFlPCodQA2UzVUJ8QekqnRTHMugwwk3X3ZHz1uVOWwCNVFoqpXgykIC8Fs6q0xhE0UE+4C7Qwd6aEJO3GexJ6ratZKzpclRs9V4t06Y1mP02wIUVuSqsKdE+WlNHcuQ+RCRwbM1/3ESNXYWeD5x+Yf/6DL/0qYFI8O/ToapRiy9HULZDW9Oj1EVd83pKlmVUFqw+QL+hNUQWPa9lVpWdse08X3d7FpSi9mPjRilD7zVDBaFC2US8Fh3J9YPSd3V56HuukbnmLcbcpeV7g3/7p2yKHcKMc5qRq3AbBLyTScYr84SpqOQFOKvbo7yqy28n4YVRgiZo64Mmx/Q4kPE8CP5BoozEZwoDNcSeAd5wbh2NTaTo6hoYHYrgNP/b3VqMLM7O/XnqRnp6J9hdUM9ct

Steps to reproduce

Create a simple directive:

directives/vTest.ts

import type { Directive } from 'vue'

export const vTest: Directive<HTMLElement, string, 'all' | 'none'> = {
  beforeMount() {},
}

Import it, not using all the modifiers at once.

App.vue

<template>
  <div v-test.all></div>
</template>

<script setup lang="ts">
import { vTest } from './directives/vTest'
</script>

What is expected?

No error.

What is actually happening?

The following error appears (in VSCode), mentioning a "runtime.core.d.ts" type:
image

Thye issue appears to be here:
image

Where DirectiveModifiers maps to Record<K, boolean> where it should be Partial<Record<K, boolean>>, since no obligation exists to have any modifier at all, let along all of them at once.

System Info

No response

Any additional comments?

First mentioned in vuejs/language-tools#5080, but marked as an upstream error.

@ludwig801 ludwig801 changed the title Directive type definition wrong "modifiers" definition Directive type definition has wrong "modifiers" definition Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants