When using pnpm instead of npm, my .d.ts declaration files don't work.

I'm using this .d.ts file:
import type * as CSS from "csstype";

declare module "csstype" {
interface Properties {
// Allow any CSS Custom Properties
[index: `--${string}`]: any;
}
}
import type * as CSS from "csstype";

declare module "csstype" {
interface Properties {
// Allow any CSS Custom Properties
[index: `--${string}`]: any;
}
}
to allow me to easily use CSS custom properties in style={{}} tags. I tried creating a new next.js project with pnpm (pnpm create next-app) and adding this declaration at the root of the project and it doesn't work, the editor is reporting errors and my build fails. If I move the project over to npm (remove node modules, remove pnpm-lock.yaml, run npm i), it starts working and my build succeeds. Any ideas?
1 Reply
praskoo
praskooOP16mo ago
In case anyone finds this, the solution was installing csstype (pnpm add -D csstype), because of how pnpm resolves dependencies versus npm.
Want results from more Discord servers?
Add your server