Skip to content

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

Open
BobbyLin23 wants to merge 1 commit into
nuxt-hub:mainfrom
BobbyLin23:fix/db-schema-build-typescript7
Open

fix(db): skip dts generation when TypeScript 7 is resolved#922
BobbyLin23 wants to merge 1 commit into
nuxt-hub:mainfrom
BobbyLin23:fix/db-schema-build-typescript7

Conversation

@BobbyLin23

Copy link
Copy Markdown

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 tsdown@0.18.4 + typescript@7.0.2 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.

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