mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-23 16:48:22 +00:00
[flow] typecheck getParam to actually check that key and fallback are valid (#5074)
* Update flow type definition for getParam to actually check key and fallback are valid * add changelog entry for `getParam` flow type changes * Return "any" in `getParam` if params are not defined in the navigation state * use void in place of any
This commit is contained in:
parent
0c9014e52f
commit
0c4845f2ff
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Update `getParam` flow typings to check `key` and `fallback` arguments, as well as return the correct type automatically.
|
||||
|
||||
## [2.17.0] - [2018-09-25](https://github.com/react-navigation/react-navigation/releases/tag/2.17.0)
|
||||
|
||||
### Changed
|
||||
|
11
flow/react-navigation.js
vendored
11
flow/react-navigation.js
vendored
@ -533,7 +533,16 @@ declare module 'react-navigation' {
|
||||
eventName: string,
|
||||
callback: NavigationEventCallback
|
||||
) => NavigationEventSubscription,
|
||||
getParam: (paramName: string, fallback?: any) => any,
|
||||
getParam: <ParamName>(
|
||||
paramName: ParamName,
|
||||
fallback?: $ElementType<$PropertyType<{|
|
||||
...{| params: {| [ParamName]: void |} |},
|
||||
...$Exact<S>,
|
||||
|}, 'params'>, ParamName>,
|
||||
) => $ElementType<$PropertyType<{|
|
||||
...{| params: {| [ParamName]: void |} |},
|
||||
...$Exact<S>,
|
||||
|}, 'params'>, ParamName>,
|
||||
dangerouslyGetParent: () => NavigationScreenProp<*>,
|
||||
isFocused: () => boolean,
|
||||
// Shared action creators that exist for all routers
|
||||
|
Loading…
x
Reference in New Issue
Block a user