Skip to content

Commit 2b4a451

Browse files
committed
fix: correctly expose nuxt module config
1 parent eca9207 commit 2b4a451

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

packages/nuxt/src/module.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { NuxtModule } from '@nuxt/schema';
33
import { isPackageExists } from 'local-pkg';
44

55
type ComponentName = 'Field' | 'Form' | 'ErrorMessage' | 'FieldArray';
6-
interface VeeValidateModuleOptions {
6+
export interface VeeValidateNuxtOptions {
77
autoImports?: boolean;
88
componentNames?: Partial<Record<ComponentName, string>>;
99
}
@@ -32,9 +32,9 @@ const composables = [
3232
'useValidateForm',
3333
];
3434

35-
export default defineNuxtModule<VeeValidateModuleOptions>({
35+
export default defineNuxtModule<VeeValidateNuxtOptions>({
3636
meta: {
37-
name: 'vee-valiate',
37+
name: 'vee-validate',
3838
configKey: 'veeValidate',
3939
},
4040
defaults: {
@@ -65,9 +65,9 @@ export default defineNuxtModule<VeeValidateModuleOptions>({
6565
checkForZod(options);
6666
}
6767
},
68-
}) as NuxtModule<VeeValidateModuleOptions>;
68+
}) as NuxtModule<VeeValidateNuxtOptions>;
6969

70-
function checkForZod(options: VeeValidateModuleOptions) {
70+
function checkForZod(options: VeeValidateNuxtOptions) {
7171
if (isPackageExists('zod') && !isPackageExists('@vee-validate/zod')) {
7272
logger.warn(
7373
'You seem to be using zod, but you have not installed @vee-validate/zod. Please install it to use zod with vee-validate.'
@@ -98,7 +98,7 @@ function checkForZod(options: VeeValidateModuleOptions) {
9898
return false;
9999
}
100100

101-
function checkForYup(options: VeeValidateModuleOptions) {
101+
function checkForYup(options: VeeValidateNuxtOptions) {
102102
if (isPackageExists('yup') && !isPackageExists('@vee-validate/yup')) {
103103
logger.warn(
104104
'You seem to be using yup, but you have not installed @vee-validate/yup. Please install it to use yup with vee-validate.'
@@ -128,3 +128,12 @@ function checkForYup(options: VeeValidateModuleOptions) {
128128

129129
return false;
130130
}
131+
132+
declare module '@nuxt/schema' {
133+
interface NuxtConfig {
134+
'vee-validate'?: VeeValidateNuxtOptions;
135+
}
136+
interface NuxtOptions {
137+
'vee-validate'?: VeeValidateNuxtOptions;
138+
}
139+
}

0 commit comments

Comments
 (0)