I have a super simple code snippet here, but no matter which editor I use (Webstorm, VSCode) I get red underlines under my SearchBar's "onChangeText" property with the following message:
TS2322: Type '(val: string) => void' is not assignable to type '((text: string) => void) & ((text: string) => void) & (() => any) & (() => any) & (() => any) & ((text: string) => void) & (() => any) & (() => any) & (() => any)'. Type '(val: string) => void' is not assignable to type '() => any'.
The code is as follows:
import React from "react";import { useState } from "react";import { StyleSheet, View } from "react-native";import { SearchBar } from "react-native-elements";import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";import ScreenWrapper from "../styled/ScreenWrapper";const HomeScreen = (): JSX.Element => { const [searchString, setSearchString] = useState(""); function updateSearch(val:string):void { setSearchString(val) } return (<ScreenWrapper><KeyboardAwareScrollView contentContainerStyle={styles.container} resetScrollToCoords={{ x: 0, y: 0 }} scrollEnabled={false}><SearchBar placeholder="Type here to search tournaments" onChangeText={updateSearch} value={searchString} /></KeyboardAwareScrollView></ScreenWrapper> );};
The code seems to compile and execute just fine, but the error in the editor is driving me nuts. Is there a good reason that this is showing?