After importing the public component
"rd-component": "^0.1.53"
, using this code:
import { Pay } from "rd-component";
An error is displayed:
Could not find a declaration file for module 'rd-component'. '/Users/xiaoqiangjiang/source/reddwarf/frontend/snap-web/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a8dacc85cbc7c5c6dcc7cec6ccc1c6cdbfc8c9fafaf3c4c2debabbab">[email protected]</a>_@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a7e737a6f792164656e6f4a3b3c243b32243832">[email protected]</a><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="08577a6d696b7c257a6d6c7d7048302638263d">[email protected]</a><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83dcf1ecefeff6f3c3b0adb1b2adb5">[email protected]</a><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e1be97889584a1d5cfd2cfd4">[email protected]</a>/node_modules/rd-component/dist/rd-component.es.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/rd-component` if it exists or add a new declaration (.d.ts) file containing `declare module 'rd-component';`ts(7016)
To address this, I included a typings.d.ts
file located in the project folder './typings/typings.d.ts', with the following content:
declare module 'rd-component';
I then added the type root configuration to the tsconfig.json
like so:
"typeRoots": [
"./typings"
],
and included it as follows:
"include": [
"src","typings/typings.d.ts"
]
However, when running the build configuration:
"build": "export NODE_ENV=production && tsc && vite build --mode production",
The dist folder does not contain the typing.d.ts
definition. What am I missing here? How can I ensure that vite compiles the typings.d.ts
file?