* fix(types): the directive's modifiers should be optional
* fix: test
---------
Co-authored-by: edison <daiwei521@126.com>
mounted(el, binding) {
expectType<HTMLElement>(el)
expectType<string>(binding.value)
- expectType<{ prevent: boolean; stop: boolean }>(binding.modifiers)
+ expectType<{ prevent?: boolean; stop?: boolean }>(binding.modifiers)
expectType<'arg1' | 'arg2'>(binding.arg!)
// @ts-expect-error not any
value: number
oldValue: number | null
arg?: 'Arg'
- modifiers: Record<'a' | 'b', boolean>
+ modifiers: Partial<Record<'a' | 'b', boolean>>
}>(testDirective<number, 'a' | 'b', 'Arg'>())
expectType<{
| ObjectDirective<HostElement, Value, Modifiers, Arg>
| FunctionDirective<HostElement, Value, Modifiers, Arg>
-export type DirectiveModifiers<K extends string = string> = Record<K, boolean>
+export type DirectiveModifiers<K extends string = string> = Partial<
+ Record<K, boolean>
+>
export function validateDirectiveName(name: string): void {
if (isBuiltInDirective(name)) {