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 committed by GitHub
parent 622d10e210
commit cdc4a23107
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -226,7 +226,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>`, ` [${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) ].filter(Boolean)
return [ return [

View File

@ -295,7 +295,7 @@ export default defineUntypedSchema({
* function () {} * 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: { modules: {
$resolve: (val: string[] | undefined): string[] => (val || []).filter(Boolean), $resolve: (val: string[] | undefined): string[] => (val || []).filter(Boolean),