Skip to content

fix(db): skip dts generation when TypeScript 7 is resolved - #922

Merged
atinux merged 1 commit into
nuxt-hub:mainfrom
BobbyLin23:fix/db-schema-build-typescript7
Oct 19, 2026
Merged

atinux merged 1 commit into
nuxt-hub:mainfrom
BobbyLin23:fix/db-schema-build-typescript7

Conversation

@BobbyLin23

Copy link
Copy Markdown
Contributor

Problem

nuxt prepare / nuxt build / nuxt db generate crash with Cannot read properties of undefined (reading 'useCaseSensitiveFileNames') when the project resolves TypeScript 7 (the native Go port).

buildDatabaseSchema passes dts: { build: false, tsconfig: false, newContext: true } to tsdown. That enables rolldown-plugin-dts, which at import time calls ts.sys.useCaseSensitiveFileNames. TypeScript 7.0 does not ship the JS compiler API (ts.sys, ts.createProgram, …), so the plugin throws before any .d.mts is generated. See the local patch in personal-website that works around this by always disabling dts.

Fix

Detect the resolved TypeScript version and pass dts: false when it is 7+, keeping .d.mts generation for TypeScript 5/6 and for projects without TypeScript installed (both are valid states, since typescript is an optional peer dependency of tsdown).

Disabling .d.mts generation on TS7 is safe: the module already falls back to export * from './schema.mjs' for the hub:db:schema typing when schema.d.mts is missing (see schemaTypes handling in module.ts), and the schema build tests assert on .mjs output only.

Verification

  • pnpm test — 116 passed, 3 skipped (includes a new regression test for the version predicate, covering 7.0.0-dev.* prereleases, TS 5/6 and no-TypeScript cases).
  • pnpm lint on changed files passes.
  • Reproduced the crash with the current [email protected] + [email protected] combo, then confirmed the patched build produces schema.mjs and runs nuxt prepare, nuxt build and the full E2E suite successfully in the affected project.

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@BobbyLin7 is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxthub/core@922

commit: 563b398

@atinux
atinux force-pushed the fix/db-schema-build-typescript7 branch from 563b398 to 5825933 Compare October 19, 2026 21:00
@atinux
atinux merged commit 2db3913 into nuxt-hub:main Oct 19, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants