JiLiZART/BBob

Could not find a declaration file for module '@bbob/react/es/render'

Closed this issue · 1 comments

I noticed the issue #89, and I found myself dealing with some typescript errors.

Could not find a declaration file for module '@bbob/react/es/render'. 'd:/WindowsDesktopDocsEtc/Documents/MxRepos/pz-description-editor/node_modules/@bbob/react/es/render.js' implicitly has an 'any' type.

and the error

Could not find a declaration file for module '@bbob/preset-react'. 'd:/WindowsDesktopDocsEtc/Documents/MxRepos/pz-description-editor/node_modules/@bbob/preset-react/lib/index.js' implicitly has an 'any' type.

I would like to share my simple solution for this issue for the next person that tries to google it, replace the import from.
with the following

const presetReact = require('@bbob/preset-react').default
const bbobReactRender = require('@bbob/react/es/render').default;

Let me know if there is a better solution to this error.

My dependencies:

"dependencies": {
   "@bbob/preset-react": "^2.8.1",
   "@bbob/react": "^2.8.1",
   "@testing-library/jest-dom": "^5.16.5",
   "@testing-library/react": "^13.4.0",
   "@testing-library/user-event": "^13.5.0",
   "@types/jest": "^27.5.2",
   "@types/node": "^16.18.3",
   "@types/react": "^18.0.24",
   "@types/react-dom": "^18.0.8",
   "react": "^18.2.0",
   "react-dom": "^18.2.0",
   "react-scripts": "5.0.1",
   "react-textarea-autosize": "^8.3.4",
   "typescript": "^4.8.4",
   "web-vitals": "^2.1.4"
 },
 "devDependencies": {
   "autoprefixer": "^10.4.13",
   "postcss": "^8.4.18",
   "tailwindcss": "^3.2.1"
 }

Project made using version 5.0.1 of create-react-app

Thanks for solution. I will add TypeScript support in near future :)