sveltejs / sveltejs/cli

Add `"types": ["node"]` in `tsconfig.json` when needed

Open
#1,092 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:add pkg:create
Dominant language
TypeScript
Stars
506
Forks
107
Avg merge
5d 15h
Merged PRs (30d)
28

Description

Describe the bug

When pnpm check is ran in the default minimal template:

pnpm dlx sv@0.15.3 create --template minimal --types ts --install pnpm ./

This warning is logged, which is valid since @types/node is not installed.

d:\_\tsconfig.json:1:1
Warn: Cannot find type definition file for 'node'.
  The file is in the program because:
    Entry point of type library 'node' specified in compilerOptions

Why not move "types": ["node"], to the tsconfig.json generated by the SV CLI?

- .svelte-kit\tsconfig.json
+ tsconfig.json

e.g. When ESLint add-on is selected which relies on node:path, this can be done:

  1. @types/node is installed
  2. "types": ["node"], is added
Reproduction
pnpm dlx sv@0.15.3 create --template minimal --types ts --install pnpm ./
pnpm check

pnpm i @types/node -D
pnpm check
Logs

System Info
System:
  OS: Windows 11 10.0.26200
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 2.85 GB / 31.48 GB
Binaries:
  Node: 24.15.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\28376_1778829182710\node.EXE
  Yarn: 1.22.22 - C:\Users\hyunb\AppData\Local\fnm_multishells\28376_1778829182710\yarn.CMD
  npm: 11.12.1 - C:\Users\hyunb\AppData\Local\fnm_multishells\28376_1778829182710\npm.CMD
  pnpm: 11.1.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\28376_1778829182710\pnpm.CMD
  Deno: 2.4.0 - C:\Users\hyunb\.deno\bin\deno.EXE
Browsers:
  Chrome: 148.0.7778.97
  Edge: Chromium (140.0.3485.54)
  Firefox: 150.0.3 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
  @sveltejs/adapter-auto: ^7.0.1 => 7.0.1
  @sveltejs/kit: ^2.57.0 => 2.59.1
  @sveltejs/vite-plugin-svelte: ^7.0.0 => 7.1.2
  svelte: ^5.55.2 => 5.55.5
  vite: ^8.0.7 => 8.0.12
Severity

annoyance

Additional Information

No response

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

Start with the SV CLI path used by pnpm dlx sv@0.15.3 create --template minimal --types ts --install pnpm ./ and inspect how it generates tsconfig.json and .svelte-kit/tsconfig.json. Reproduce the warning with pnpm check; done means the minimal TypeScript template no longer warns when @types/node is absent, while the ESLint add-on still supports node:path when its types are installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.