question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript error: No overload matches this call.

See original GitHub issue

I just init a expo typescript project. Then add ‘react-native-paper’ in my project. When try to use Button component it gives me this typescript error. Do you have any idea why getting error?

Error

No overload matches this call.
  Overload 1 of 2, '(props: Pick<Props, "ref" | "style" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 57 more ... | "contentStyle"> & { ...; }, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error.
    Type '{ children: string; mode: "outlined"; onPress: () => void; }' is missing the following properties from type

Code -

<PaperProvider>
  <View >
      <Button mode="outlined" onPress={() => {}}>
         press me
      </Button>
   </View>
</PaperProvider>

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~40.0.0",
    "expo-status-bar": "~1.0.3",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-paper": "^4.5.0",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@types/react": "~16.9.35",
    "@types/react-dom": "~16.9.8",
    "@types/react-native": "~0.63.2",
    "typescript": "~4.0.0"
  },
  "private": true
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:22
  • Comments:35 (1 by maintainers)

github_iconTop GitHub Comments

25reactions
saurabhnemadecommented, Feb 6, 2021

It seems this PR once closed will fix problem #2522

Currently on “@types/react-native”: “0.63.47” and the issue still persists.

Working configuration right now:

    "react-native": "~0.63.4",
    "react-native-paper": "^4.7.1",
    "@types/react-native": "^0.62.0",

There is one easy way to know what should be these versions.

Just pick version of @types/react-native from https://github.com/callstack/react-native-paper/blob/main/package.json

18reactions
rahadkccommented, Jan 5, 2021

Hi got the solution. When initializing project using expo init it automatically added types for react-native project version

  • @types/react-native@0.63.2

After upgrading the react-native type version to

  • @types/react-native@0.63.40

It is working fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No overload matches this call. Type 'string' is not assignable to ...
Solution 1: Keep numeric enum signals · Solution 2: Use pure signal string literal types · Solution 3: Change to string enum (no...
Read more >
No overload matches this call error in TypeScript | bobbyhadz
The error "No overload matches this call" occurs when we call a function and pass it a parameter that doesn't match any of...
Read more >
No overload matches this call with styled components ...
No overload matches this call in TypeScript is really annoying and there aren't too many solutions around there, though we have a solution!...
Read more >
How to fix error TS2769 http options no overload matches this ...
This gave me this error in typeScript / Angular: error TS2769: No overload matches this call. Solution. You have to cast httpOptions to...
Read more >
"No overload matches this call" typescript error when passing ...
The problem is that Stores is typed as "array needs to contain at least one entry", while stores is typed as "array with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found