framework
framework copied to clipboard
`nuxi prepare` yields incorrect type definitions in target folder's `.nuxt`
Environment
- Operating System:
Windows_NT - Node Version:
v16.14.0 - Nuxt Version:
3.0.0-rc.12 - Nitro Version:
0.6.0 - Package Manager:
[email protected] - Builder:
vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
- Clone this branch of my PR fork of nuxt-session
- Open
src/types.ts - Notice that
SessionOptions#ipPinninghas the typeSessionIpPinningOptions|boolean - Notice that
ModuleOptions#sessionhas the typePartial<SessionOptions> - Notice that
FilledModuleOptionsisModuleOptionswhere no member isPartial - Notice that
ModuleRuntimeConfig#sessionhas the typeFilledModuleOptions - Open
src/module.ts - Notice everything from
src/types.tsis exported there (results is the same if types are declared directly insrc/module.ts) - Run
npm run dev:prepare - Open
playground/.nuxt/types/schema.d.ts - Notice that
RuntimeConfig#session.session.ipPinninghas typeboolean
Describe the bug
Types generated by nuxi prepare seem to be inferred from the default values even when interfaces are properly provided and exported as well as properly picked up by nuxt-module-build --stub.
Types generated by nuxi prepare should use the provided interfaces when present, and only rely on inference when absent.
Additional context
No response
Logs
No response