From 3ba1315e72dc391eb73b5d99f6b4707d655aaad3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Mon, 11 Dec 2023 16:23:39 +0800 Subject: [PATCH] refactor(runtime-vapor): remove argument generic --- packages/runtime-vapor/src/directive.ts | 32 +++++++------------------ 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/runtime-vapor/src/directive.ts b/packages/runtime-vapor/src/directive.ts index 2eeb9277c2..ab7ca782ad 100644 --- a/packages/runtime-vapor/src/directive.ts +++ b/packages/runtime-vapor/src/directive.ts @@ -4,16 +4,12 @@ import { effect } from './scheduler' export type DirectiveModifiers = Record -export interface DirectiveBinding< - V = any, - A = string, - M extends string = string, -> { +export interface DirectiveBinding { instance: ComponentInternalInstance | null source?: () => V value: V oldValue: V | null - arg?: A + arg?: string modifiers?: DirectiveModifiers dir: ObjectDirective } @@ -21,9 +17,8 @@ export interface DirectiveBinding< export type DirectiveHook< T = any | null, V = any, - A = string, M extends string = string, -> = (node: T, binding: DirectiveBinding) => void +> = (node: T, binding: DirectiveBinding) => void // create node -> `created` -> node operation -> `beforeMount` -> node mounted -> `mounted` // effect update -> `beforeUpdate` -> node updated -> `updated` @@ -36,13 +31,8 @@ export type DirectiveHookName = | 'updated' | 'beforeUnmount' | 'unmounted' -export type ObjectDirective< - T = any, - V = any, - A = string, - M extends string = string, -> = { - [K in DirectiveHookName]?: DirectiveHook | undefined +export type ObjectDirective = { + [K in DirectiveHookName]?: DirectiveHook | undefined } & { deep?: boolean } @@ -50,16 +40,12 @@ export type ObjectDirective< export type FunctionDirective< T = any, V = any, - A = string, M extends string = string, -> = DirectiveHook +> = DirectiveHook -export type Directive< - T = any, - V = any, - A = string, - M extends string = string, -> = ObjectDirective | FunctionDirective +export type Directive = + | ObjectDirective + | FunctionDirective export type DirectiveArguments = Array< | [Directive | undefined] -- 2.47.2