Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Typescript definitions not updated #3

Closed
jbrodriguez opened this issue Feb 8, 2018 · 1 comment
Closed

Typescript definitions not updated #3

jbrodriguez opened this issue Feb 8, 2018 · 1 comment

Comments

@jbrodriguez
Copy link

I'd like to say that I feel the jump to 1.0.0 stable was rushed.

As for the bug

Argument of type '{ dispatch: NavigationDispatch<any>; state: NavigationState; addListener: any; }' is not assignable to parameter of type 'NavigationProp<NavigationState, NavigationStackAction>'.
  Object literal may only specify known properties, and 'addListener' does not exist in type 'NavigationProp<NavigationState, NavigationStackAction>'.

comes from

<Navigator
  navigation={addNavigationHelpers({
	dispatch: this.props.dispatch as NavigationDispatch<any>,
	state: this.props.nav,
	addListener,
  })}
/>

since https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-navigation/index.d.ts isn't up to date.

Since I create the store in a separate file from the creation of the Navigator, I had to define an instance property (this.addListener), so that it's created after the redux middleware.

@Ashoat
Copy link
Member

Ashoat commented Feb 10, 2018

It seems like this issue has to do with react-navigation as a whole, rather with the Redux integration specifically. It has to do specifically with the type of Navigator, which is defined in the main react-navigation package, including the definition of the navigation prop which is used for Redux integration. (The same navigation prop is used for nesting navigators.)

More generally, this question is about figuring out a way to maintain a TypeScript libdef as we iterate on the library. (We have a pipeline in place for this for Flow, but not for TypeScript right now.)

Please post this issue on the main react-navigation issue tracker so it can get the appropriate eyeballs. I have some thoughts and advice, feel free to tag me in the post! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants