mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-12 09:21:09 +08: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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user