skip to Main Content

I was working on a react-native project (not using typescript). All of a sudden I noticed I could not use react native APIs with auto-completion. When hovering over react native import get the warning "Could not find a declaration file for module ‘react-native’ ../node_modules/react-native/index.js’ implicitly has an ‘any’ type. Try npm i --save-dev @types/react-native if it exists or add a new declaration (.d.ts) file containing declare module 'react-native'; ". once again I’m not using typescript

P.S: I forgot to mention that I’m using expo sdk 44

2

Answers


  1. That error is very common, and can mean a huge variety of things. One thing it never is – is anything that has to do with Typescript. That’s a big red-herring and don’t waste your time searching for a solution in regards to that.

    I’d suggest a full restart and cleaning of your project, and then the error messages are usually more specific. So clear your cache, restart your computer, delete node_modules and then npm install again.

    Login or Signup to reply.
  2. I had the same issue and the cause was due to this syntax error of 2 className property tags on an element, in another component file of my app, see below:

    return (
        <View 
            className="bg-purple-600 rounded-lg rounded-tr-none px-5 py-3 mx-3 my-2"
            className="bg-red-400 rounded-lg rounded-tl-none px-5 py-3 mx-3 my-2 ml-14"
        >
            // content
        </View>
    );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search