Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Dec 15, 2025

Fixes #710

Problem

JSON fields with $type<SomeType>() return any instead of the typed result.

Root cause: ts doesn't resolve types from .d.ts files for .mjs imports. For ESM modules, TypeScript looks for .d.mts declaration files.

Additionally, export * as schema from './db/schema.mjs' inside a declare module block doesn't resolve paths correctly for virtual modules.

Reproduction

# Clone repro folder
git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-710

# Install and run
cd nuxthub-710 && pnpm install && pnpm dev

# Check server/api/test.ts - styles field shows as `any`

Verify fix

Video with LSP in action

Screen.Recording.2025-12-15.180533.mp4

cd repros && git sparse-checkout add nuxthub-710-fixed
cd nuxthub-710-fixed && pnpm install && pnpm dev

# Check server/api/test.ts - styles field now shows as `Style[]`

The -fixed folder includes a pnpm patch with both changes.

@vercel
Copy link

vercel bot commented Dec 15, 2025

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

A member of the Team first needs to authorize it.

@onmax
Copy link
Contributor Author

onmax commented Dec 15, 2025

CI failure is unrelated to this PR - it's a pre-existing test issue from #713 (neon-http error message format mismatch). Main branch also failing with same test.

@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nuxthub Ready Ready Preview Dec 16, 2025 5:12pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 16, 2025

npm i https://pkg.pr.new/@nuxthub/core@723

commit: 90c3e5d

@atinux atinux merged commit a76cc57 into nuxt-hub:main Dec 16, 2025
9 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.

Drizzle JSON types are not transferred to schema.mjs on sqlite

2 participants