You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the useNavigation hook from @react-navigation/native in TypeScript, optional arguments are not being correctly inferred and produce a type error.
Expected Behavior:
Optional arguments should be correctly inferred and not produce a type error.
Actual Behavior:
Optional arguments produce a type error, requiring the use of the // @ts-ignore comment to suppress the error.
Steps to Reproduce:
Use the useNavigation hook with an optional argument.
Attempt to pass a string value as the optional argument.
Observe the type error.
import{useNavigation}from'@react-navigation/native';constnavigation=useNavigation();constnavigate=(screenName?: string)=>{// Argument of type 'string' is not assignable to parameter of type 'never'navigation.navigate(screenName)// Workaround with // @ts-ignore// @ts-ignorenavigation.navigate(screenName)}
The text was updated successfully, but these errors were encountered:
When using the
useNavigation
hook from@react-navigation/native
in TypeScript, optional arguments are not being correctly inferred and produce a type error.Expected Behavior:
Optional arguments should be correctly inferred and not produce a type error.
Actual Behavior:
Optional arguments produce a type error, requiring the use of the
// @ts-ignore
comment to suppress the error.Steps to Reproduce:
The text was updated successfully, but these errors were encountered: