resend / resend-node

Resend's Official Node.js SDK
MIT License
550 stars 39 forks source link

React declaration not found in Fastify (Node.js) app #406

Open shidoxo opened 1 month ago

shidoxo commented 1 month ago
node_modules/resend/dist/index.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'react'. 'C:/Users/<redacted>/<redacted>/<redacted>/<redacted>/<redacted>/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

1 import * as React from 'react';

Found 1 error in node_modules/resend/dist/index.d.ts:1

Why do i need React at all in my NodeJS server? If there's React, why is declaration file not provided?

mcfarljw commented 1 week ago

I'm seeing the same same issue. The reason is because there is a react dependency so for those not using react it's causing typing errors.

https://github.com/resend/resend-node/blob/c69c13f582314011281ba2b667a9645978f43839/package.json#L45C5-L45C36 this should not be a required dependency as many aren't using react.

Running npm i --save-dev @types/react fixes the issue but we shouldn't have to install react typings if we're not using react.