Skip to content

Type safety with NavigationService.push() and other methods? #731

Description

@tconroy

Hi!

Wondering if it's possible to get type safety out of the helper methods exposed by this library.

i.e, if you define types in your Navigators like so:

export type FeedStackParamList = {
  Community: {
    name: string;
  };
};

const FeedsStack = createNativeStackNavigator<FeedStackParamList>();

it would be great if we got type safety:

import * as NavigationService from 'react-navigation-helpers';

const navigateToCommunity = () => {
  NavigationService.push("Community", {
    wrongProp: 'foo', // <--- this would error since it's not declared for the route
  });
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions