fastify-type-provider-typebox icon indicating copy to clipboard operation
fastify-type-provider-typebox copied to clipboard

Fastify-tsconfig not found (also needs to be under peerDependencies)

Open melroy89 opened this issue 1 month ago • 5 comments

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.6.1

Plugin version

6.1.0

Node.js version

22.21.1

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Linux Mint 22.2

Description

It seems that the fastify-tsconfig is not automatically getting installed when using fastify-type-provider-typebox.

The reason might be that the package is only under devDependencies, but not under peerDependencies.

See here: https://github.com/fastify/fastify-type-provider-typebox/blob/main/package.json#L87

Could you make these dependecies also put under peerDependencies? Especially since you are using it in your own tsconfig.json file here: https://github.com/fastify/fastify-type-provider-typebox/blob/main/tsconfig.json#L2

Ps. I'm using pnpm

Image

Link to code that reproduces the bug

TODO

Expected Behavior

I expected no issues with the our own tsconfig.json file of fastify-type-provider-typebox that extends fastify-tsconfig and that any required peer dependency will be installed automatically.

Especially in pnpm you really need to set this kind of dependencies to peerDependencies (as well as devDependencies).

melroy89 avatar Oct 28 '25 21:10 melroy89

Why do you even use the tsconfig from this package?

Uzlopak avatar Oct 28 '25 22:10 Uzlopak

Why do you even use the tsconfig from this package?

That's a really good question. I don't use your tsconfig directly from your package.

I believe the typescript language server in vscode is failing to parse and process this package. Causing this error to show up.

melroy89 avatar Oct 29 '25 02:10 melroy89

@Uzlopak OK, I can confirm it's NOT due to any external extension, but like I said before; VSCode is using a Typescript language server, also known as "TS Server". Which is a built-in server within VSCode.

Within the VS Code editor you can go to Preferences -> Extensions -> All the way to the bottom, you will see "TypeScript and JavaScript Language features". (Despite its under extension, again VSCode is shipped this language server by default, also no way to uninstall it).

The "TS Server" in particular is triggering this error in the editor:

Image

Despite your package is within the node_modules directory, the TS Server will try to read-in and parse the tsconfig.json file apparently; for reasons...

Image

Finally, I enabled the TS Server logging in vscode. And here you got the output (snippet) of the problem in the TS Server logs:

Info 1020 [13:24:42.593] event:
    {"seq":0,"type":"event","event":"projectLoadingFinish","body":{"projectName":"/home/melroy/my_project/node_modules/.pnpm/@[email protected][email protected]/node_modules/@fastify/type-provider-typebox/tsconfig.json"}}

...
  {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"/home/melroy/my_project/node_modules/.pnpm/@[email protected][email protected]/node_modules/@fastify/type-provider-typebox/dist/esm/index.d.mts","configFile":"/home/melroy/my_project/node_modules/.pnpm/@[email protected][email protected]/node_modules/@fastify/type-provider-typebox/tsconfig.json","diagnostics":[{"start":

{"line":2,"offset":14},"end":{"line":2,"offset":32},"text":"File 'fastify-tsconfig' not found.","code":6053,"category":"error","fileName":"/home/melroy/my_project/node_modules/.pnpm/@[email protected][email protected]/node_modules/@fastify/type-provider-typebox/tsconfig.json"}]}}
Info 1023 [13:24:42.594] Project '/home/melroy/my_project/apps/backend/tsconfig.json' (Configured)
.....

As you can see its says here also "File 'fastify-tsconfig' not found."

melroy89 avatar Oct 29 '25 12:10 melroy89

Thats odd, because afaik the tsconfig should be irrelevant.

Uzlopak avatar Oct 29 '25 13:10 Uzlopak

I'm just reporting the errors I get from the ts server. So it's up to us now to see if we want to fix this issue or ignore it?

melroy89 avatar Oct 29 '25 13:10 melroy89