nuxt / nuxt/starter

[module] server types are broken when executing test:types

Open
#831 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
580
Forks
199
Avg merge
1h 49m
Merged PRs (30d)
28

Description

Hi, I noticed that the typecheck for the module template seems to be broken.

Reproduction:

  1. Create a new module by running pnpx nuxi init -t module module-name
  2. Install the dependencies
  3. Add something to the runtime/server directory that imports from "#imports"
    E.g.:
    import { defineEventHandler } from '#imports'
    
    export default defineEventHandler((event) => { console.log(event) })
    
  4. Run pnpm dev:prepare to prepare the types
  5. Run pnpm test:types

Result:
image

Within VS Code everything works as expected and no type errors are shown.

Installed TS version: 5.5.4
Installed vue-tsc version: 2.0.29

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Generate the module template with pnpx nuxi init -t module, then inspect the generated runtime/server setup and prepared type files after pnpm dev:prepare. Compare the behavior in VS Code with pnpm test:types; done means a server file importing from #imports typechecks without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.