fastify-vite
fastify-vite copied to clipboard
Missing Type Declarations for `@fastify/vite/plugin`
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.3.2
Plugin version
8.1.3
Node.js version
20.19.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Ubuntu 24.04 LTS
Description
vite.config.js:
// @ts-check
import viteFastify from '@fastify/vite/plugin';
log:
vite.config.js:3:25 - error TS7016: Could not find a declaration file for module '@fastify/vite/plugin'. '/home/projects/github-udavhkpz/node_modules/@fastify/vite/plugin.mjs' implicitly has an 'any' type.
If the '@fastify/vite' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '@fastify/vite/plugin';`
3 import viteFastify from '@fastify/vite/plugin';
~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in vite.config.js:3
Link to code that reproduces the bug
https://stackblitz.com/edit/github-udavhkpz?file=vite.config.js&startScript=build,start
Expected Behavior
When importing @fastify/vite/plugin in a TypeScript project, it is useful to have type declarations available so that modules can be used without compiler errors.
If the plugin is intended to be used with TypeScript, having corresponding .d.ts declarations (or publishing the plugin path via types/exports in package.json) would improve compatibility and developer experience.
Thanks!
It's not just that package for me.
If I do:
pnpm dlx giget@latest gh:fastify/fastify-vite/starters/react-typescript#dev app
cd app
pnpm tsc -p src/client
a whole bunch of Typescript arise.