Skip to content

Run typecheck for client *and* server with nuxi typecheck #323

Closed

Description

@TheAlexLichter

When running nuxi typecheck, only the client types are checked right now. Ideally, also the tsconfig.json of the server should be used and the nitro/server side should be checked!

Activity

  1. added
    enhancement
    on Jan 6, 2024
  2. kaaax0815 commented on Jan 17, 2025

    @kaaax0815

    Any status on this?

  3. BobbieGoede commented on Jan 17, 2025

    @BobbieGoede
    Member

    Hmm, maybe I'm testing incorrectly but the command seems to also typecheck server files in a local test project, can someone provide a minimal reproduction shows the lack of type checking on the nitro/server side? I'll use it to try and implement type checking if it is still lacking 🙏

  4. kaaax0815 commented on Jan 19, 2025

    @kaaax0815

    I made one here for my use case
    https://stackblitz.com/edit/server-typecheck-repro?file=nuxt.config.ts

    I have to add the alias to the generated tsconfig.json for aliases to work. even tho it should be enough if its in the tsconfig.server.json

  5. BobbieGoede commented on Jan 19, 2025

    @BobbieGoede
    Member

    @kaaax0815
    Thank you for the reproduction!

    It actually looks like typecheck only checks client files (does not use tsconfig.server.json) which means the server directory should be excluded, the errors in your reproduction shouldn't be thrown at all.

    The server files are not being excluded as expected due to explicit imports/references by included files, which in this case are the auto import types generated by nitro (nuxt.d.ts > types/nitro.d.ts > types/nitro-imports.d.ts).

    @danielroe
    Should the nitro.d.ts types be included in the generated tsconfig.json or should these actually only be included in tsconfig.server.json?

    The typecheck command needs may need to be changed to run two type checks, for client files and for server files, I can look into this, but we have to prevent the server files from being included in the client tsconfig.json (not sure how).

    I have updated the reproduction and removed the additional alias config, running pnpm typecheck demonstrates server files are checked while tsconfig.server.json is not being used since it throws errors.

    Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions