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 I use dispatch to send an action (such as StackActions.replace), the type is not checked against the ParamList I provided.
typeParamList={Screen_Name: {id: string}}constAnotherScreen=()=>{constnavigation=useNavigation<NavigationProp<ParamList>>()// NOTE: The route name and params are not checked in the action. Errors are expected here.navigation.dispatch(StackActions.replace("any-string",{'any-object': ''}))// However the type is checked when using `navigate` //@ts-expect-errornavigation.navigate('Screen_Name')}
Expected behavior
The route name and params should be checked in the action when using dispatch function
Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link, a www.typescriptlang.org/play link or link to a GitHub repo under your username).
Can you provide a minimal repro which demonstrates the issue? Please try to keep the repro as small as possible and make sure that we can run it without additional setup.
A repro will help us debug the issue. The issue will be closed automatically after a while if you don't provide a repro.
Current behavior
When I use
dispatch
to send an action (such asStackActions.replace
), the type is not checked against the ParamList I provided.Expected behavior
The route name and params should be checked in the action when using
dispatch
functionReproduction
https://snack.expo.dev/@yupeng_li/dispatch-type-issue
By some reasons, the example in snack doesn't show ts error properly, so I made another one in codesandbox.
https://codesandbox.io/s/dispatch-type-issue-ki72og?file=/src/App.tsx
Platform
Packages
Environment
The text was updated successfully, but these errors were encountered: