8000 Directive type definition has wrong "modifiers" definition · Issue #12604 · vuejs/core · GitHub
[go: up one dir, main page]

Skip to content
Directive type definition has wrong "modifiers" definition #12604
@ludwig801

Description

@ludwig801

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.

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

      0