fix(nuxt,schema): accept any module in inline `modules` array (#28922)

This commit is contained in:
Daniel Roe 2024-09-10 21:16:35 +01:00
parent 8521c34594
commit 79773710c3
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
2 changed files with 2 additions and 2 deletions

View File

@ -240,7 +240,7 @@ export const schemaTemplate: NuxtTemplate = {
` [${configKey}]${options.unresolved ? '?' : ''}: typeof ${genDynamicImport(importName, { wrapper: false })}.default extends NuxtModule<infer O> ? ${options.unresolved ? 'Partial<O>' : 'O'} : Record<string, any>`,
]
}),
modules.length > 0 && options.unresolved ? ` modules?: (undefined | null | false | NuxtModule | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName, mod]) => `[${genString(mod.meta?.rawPath || importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(' | ')})[],` : '',
modules.length > 0 && options.unresolved ? ` modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ${modules.map(([configKey, importName, mod]) => `[${genString(mod.meta?.rawPath || importName)}, Exclude<NuxtConfig[${configKey}], boolean>]`).join(' | ')})[],` : '',
].filter(Boolean)
return [

View File

@ -292,7 +292,7 @@ export default defineUntypedSchema({
* function () {}
* ]
* ```
* @type {(typeof import('../src/types/module').NuxtModule | string | [typeof import('../src/types/module').NuxtModule | string, Record<string, any>] | undefined | null | false)[]}
* @type {(typeof import('../src/types/module').NuxtModule<any> | string | [typeof import('../src/types/module').NuxtModule | string, Record<string, any>] | undefined | null | false)[]}
*/
modules: {
$resolve: (val: string[] | undefined): string[] => (val || []).filter(Boolean),