fix(db): skip dts generation when TypeScript 7 is resolved - #922
Open
BobbyLin23 wants to merge 1 commit into
Open
fix(db): skip dts generation when TypeScript 7 is resolved#922BobbyLin23 wants to merge 1 commit into
BobbyLin23 wants to merge 1 commit into
Conversation
|
@BobbyLin7 is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
nuxt prepare/nuxt build/nuxt db generatecrash withCannot read properties of undefined (reading 'useCaseSensitiveFileNames')when the project resolves TypeScript 7 (the native Go port).buildDatabaseSchemapassesdts: { build: false, tsconfig: false, newContext: true }totsdown. That enablesrolldown-plugin-dts, which at import time callsts.sys.useCaseSensitiveFileNames. TypeScript 7.0 does not ship the JS compiler API (ts.sys,ts.createProgram, …), so the plugin throws before any.d.mtsis generated. See the local patch in personal-website that works around this by always disablingdts.Fix
Detect the resolved TypeScript version and pass
dts: falsewhen it is 7+, keeping.d.mtsgeneration for TypeScript 5/6 and for projects without TypeScript installed (both are valid states, sincetypescriptis an optional peer dependency oftsdown).Disabling
.d.mtsgeneration on TS7 is safe: the module already falls back toexport * from './schema.mjs'for thehub:db:schematyping whenschema.d.mtsis missing (seeschemaTypeshandling inmodule.ts), and the schema build tests assert on.mjsoutput only.Verification
pnpm test— 116 passed, 3 skipped (includes a new regression test for the version predicate, covering7.0.0-dev.*prereleases, TS 5/6 and no-TypeScript cases).pnpm linton changed files passes.tsdown@0.18.4+typescript@7.0.2combo, then confirmed the patched build producesschema.mjsand runsnuxt prepare,nuxt buildand the full E2E suite successfully in the affected project.