I have the following code in my RN application.
handleTextChange = e => {
this.setState({ value: e })
}
I use TS and this says, "parameter 'e' implicitly has 'any' type".
How can I solve this? How can I set a type to 'e' here?
You can provide a type annotation for e
in cases where it can't be inferred:
handleTextChange = (e: Event) => {
this.setState({ value: e })
}
I've used Event
for the purposes of the example, but you can use whichever type is appropriate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.