diff --git a/packages/vue-v8n/src/composables/useV7d.ts b/packages/vue-v8n/src/composables/useV7d.ts index acbd865..7fab4e3 100644 --- a/packages/vue-v8n/src/composables/useV7d.ts +++ b/packages/vue-v8n/src/composables/useV7d.ts @@ -3,7 +3,9 @@ import type { MaybeRefOrGetter } from 'vue' import type { RuleDefinition, UseV7dOptions } from '../types' export function useV7d(value: T, rules: MaybeRefOrGetter, options?: UseV7dOptions) { - const immediate = !!options?.immediate + const { + immediate = false + } = options || {} const $el = ref() const _value = ref(value) diff --git a/packages/vue-v8n/src/types.ts b/packages/vue-v8n/src/types.ts index 22d6d32..b61cae1 100644 --- a/packages/vue-v8n/src/types.ts +++ b/packages/vue-v8n/src/types.ts @@ -13,7 +13,7 @@ type RuleFunction = (value: unknown, context: RuleContext) => string | undefined export interface RuleContext {} export interface UseV7dOptions { - immediate: boolean + immediate?: boolean } export interface VueV8nOptions {}