Repository navigation
fix(types): apply the AppConfig augmentation in apps extending the layer - #1437
Merged
larbish merged 2 commits intoSep 30, 2026
Merged
Conversation
`layer/app/types/index.d.ts` has imports and exports, so it is a module and its `declare module 'nuxt/schema'` block is a module augmentation — it only takes effect once something pulls the file into the program. Nothing does in an app that installs docus from npm, so every `AppConfig` field declared there is silently missing, and the app falls back to the shapes generated from `nuxt.schema.ts`. Since 5.13.0 that breaks `nuxi typecheck` in any app extending the layer, because `useSeo` reads `AppConfig['seo']['schema']` (#1433) and only `app/types/index.d.ts` declares it: node_modules/docus/app/composables/useSeo.ts(37,53): error TS2339: Property 'schema' does not exist on type '{ title?: string; description?: string; }' `index.d.ts` is already reachable — Nuxt writes a `/// <reference path>` to it into the consumer's `.nuxt/nuxt.d.ts` — so importing the types file from there is enough to make the augmentation apply. Verified with a minimal app extending a packed build of the layer: both errors disappear, `pnpm lint` and `pnpm typecheck` still pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TCgqQUpt4KBXi9U9ae5iq6
|
@sisou is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
larbish
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
layer/app/types/index.d.tshas imports and exports, so it is a module — which makes itsdeclare module 'nuxt/schema'block a module augmentation, and those only take effect once something pulls the file into the program. Inside this repo that happens (the layer is a local directory whose files are reachable), sopnpm typecheckis green. In an app that installsdocusfrom npm, nothing imports or references it: the file is in the consumer'stsconfiginclude, andtsc --listFilesOnlyeven lists it, but the augmentation never applies.Every
AppConfigfield declared in that file is therefore silently missing in consumers, and the app falls back to the shapes generated fromnuxt.schema.ts. It's easy to miss because the fallback types are almost right — until one of them isn't.Since 5.13.0 it isn't.
useSeoreadsAppConfig['seo']['schema'](added in #1433), and onlyapp/types/index.d.tsdeclaresschema, sonuxi typechecknow fails in every app extending the layer:That type is the one generated from
layer/nuxt.schema.ts, whereseois justtitle+description.Fix
index.d.tsis already reachable in consumers — Nuxt writes/// <reference path="../node_modules/docus/index.d.ts" />into.nuxt/nuxt.d.ts— so importing the types file from there is enough:One line, no type changes, nothing new shipped (
appandindex.d.tsare both already infiles).Reproduction
A minimal app is enough — no fixture repo needed:
Before: the two
useSeo.tserrors above. After: gone.To confirm the mechanism rather than the symptom, add a marker to the augmentation:
and probe it from the app. On
mainAppConfig['zzTest']resolves tounknown(it falls throughAppConfig's index signature — the augmentation is inert). With this patch it resolves.Verified
pnpm lint— unchanged (0 errors, the pre-existingvue/no-v-htmlwarning)pnpm typecheck— passesuseSeo.tserrors goneOut of scope
github: falserejected) is a different mechanism, not fixed here: that error comes fromAppConfigInput, whichdefineAppConfigchecks against and which is fed by the generatednuxt.schema.tstypes, not by theAppConfigaugmentation. Worth a separate fix — either allowingfalseinnuxt.schema.tsor augmentingAppConfigInput.useSeo.ts:172/221(unheadResolvableArrayfor the link/script arrays) andplugins/i18n.ts:52+useAssistant.ts:59(i18n.defaultLocaleon{}).Nothing in CI would catch a regression of this, since
pnpm typecheckonly checks the layer in-repo, where the augmentation does apply. Anuxt typecheckover a small app extending a packed layer would — happy to add one if you want it in this PR.