From 83573038a28a18f79bfa27b853f31defdcac5d6c Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 13 Aug 2024 19:24:38 +0800 Subject: [PATCH] fix: prevent `undefined` error in `hasTypeExport` `names` can be null with star exports. Upstream fix to improve ts: https://github.com/unjs/mlly/pull/273 Fixes https://github.com/nuxt/module-builder/issues/309 --- src/commands/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/build.ts b/src/commands/build.ts index b4a09133..072677d8 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -203,7 +203,7 @@ async function writeTypes(distDir: string, isStub: boolean) { const schemaImports: string[] = [] const moduleExports: string[] = [] - const hasTypeExport = (name: string) => isStub || moduleReExports.find(exp => exp.names.includes(name)) + const hasTypeExport = (name: string) => isStub || moduleReExports.find(exp => exp.names?.includes(name)) if (!hasTypeExport('ModuleOptions')) { schemaImports.push('NuxtModule')