Could not find a declaration file for module 'react-chat-elements' - reactjs

I am new to development in reactJS. I would like to implement a live chat in my website and I have relied on react-chat-elements.
It gives me the error:
Could not find a declaration file for module 'react-chat-elements'.
I tried npm i --save-dev #types/react-chat-elements but the error does not go away

Related

react-native-asset module not found

Error: Cannot find module 'C:\Users\satyen\Desktop\ExpoGame\react-native.config.js'
Require stack:
C:\Users\satye\node_modules\react-native-asset\lib\cli.js
I'm trying to use custom fonts for react-native but I'm keep getting this error even though I made config file and globally installed react-native-assets still its not going.

React: npm i {any package} is not creating declaration files

I'm new to React (and really web development) and I'm working in one of the starter projects. I have tried to install several npm packages to work with and they seem to be installing correctly. I can import the class into my Main.js file but when I hover over the import it says
Could not find a declaration file for module 'react-ui-cards'. '.../Gatsby/node_modules/react-ui-cards/index.js' implicitly has an 'any' type.
and it will throw an error if I try to build using these components

Cannot use recordRTC in react project

I cannot import RecordRTC from 'recordrtc'
I have installed the node module, but when I try to import it, i receive the following error:
Could not find a declaration file for module 'recordrtc'. '/Users/jnelson/Documents/GitHub/VidApp/node_modules/recordrtc/RecordRTC.js' implicitly has an 'any' type.
Try `npm install #types/recordrtc` if it exists or add a new declaration (.d.ts) file containing `declare module 'recordrtc';` TS7016
I've tried simply declaring record rtc as an any type in a .d.ts file but that did not seem to help. I feel like this should be a common issue and either a simple solution or someone has made a .d.ts file for this?
I created the app with react-ionic. The error message above is from a local web browser from my desktop
Try npm install #types/recordrtc --save
The above error occurred because you are using TypeScript with your React application.

Trying to compile React Native app and I am getting an error about React.js not existing

I am trying to compile my first React Native project, and it all works fine from the CLI, until I try to install a new library.
After installing any library, I get various errors, culminating in this:
error: bundling failed: Error: While trying to resolve module `react` from file `/Users/myname/Desktop/Projects/ProjectName/App.js`, the package `/Users/myname/Desktop/Projects/ProjectName/node_modules/react/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/myname/Desktop/Projects/ProjectName/node_modules/react/index.js`. Indeed, none of these files exist:
I have, indeed, confirmed that those files exist.
What is going on here? I'm constantly having these errors as I am trying to use React Native, even when rebuilding the app multiple times and trying over.
Do the following steps:
Stop metro bundler
Delete node_modules folder
cd into your project folder and run:
'npm install'

Where do you add .d.ts files in React Native

I've recently installed a new package to use in React Native. As with other packages I was prompted in Visual Studio Code to:
[ts]
Could not find a declaration file for module 'react-native-material-
dropdown'. '/home/stumfi-mobile/123-app/node_modules/react-native-
material-dropdown/index.js' implicitly has an 'any' type. Try `npm
install #types/react-native-material-dropdown` if it exists or add a new
declaration (.d.ts) file containing `declare module 'react-native-
material-dropdown';`
Usually this is a trivial fix, as I just type:
npm install #types/react-native-material-dropdown
However today this failed. And I learned that npm has had some issues with tokens being compromised recently:
npm WARN notice Due to a recent security incident, all user tokenshave
been invalidated. Please see
https://status.npmjs.org/incidents/dn7c1fgrr7ng for more details. To
generate a new token, visit https://www.npmjs.com/settings/~/tokens or
run "npm login".
After investigating their links, I've decided I need to to this manually (and hopefully get to learn something). Where do I create this file (.d.ts) file containing `declare module 'react-native-material-dropdown'
Added folder types in src. And then the file anything.d.ts
/src/types/anything.d.ts
//anything.d.ts
declare module "react-native-material-dropdown";
This seems to work, a better answer with explanation is welcome.

Resources