@react-navigation/core 8.0.0-alpha.3 → 8.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/lib/module/BaseNavigationContainer.js +34 -17
  2. package/lib/module/BaseNavigationContainer.js.map +1 -1
  3. package/lib/module/ConsumedParamsContext.js +5 -0
  4. package/lib/module/ConsumedParamsContext.js.map +1 -0
  5. package/lib/module/DataLoading.js +127 -0
  6. package/lib/module/DataLoading.js.map +1 -0
  7. package/lib/module/NavigationBuilderContext.js +1 -0
  8. package/lib/module/NavigationBuilderContext.js.map +1 -1
  9. package/lib/module/NavigationIndependentTree.js +17 -8
  10. package/lib/module/NavigationIndependentTree.js.map +1 -1
  11. package/lib/module/NavigationProvider.js +22 -11
  12. package/lib/module/NavigationProvider.js.map +1 -1
  13. package/lib/module/NavigationStateContext.js.map +1 -1
  14. package/lib/module/PreventRemoveContext.js.map +1 -1
  15. package/lib/module/PreventRemoveProvider.js +37 -27
  16. package/lib/module/PreventRemoveProvider.js.map +1 -1
  17. package/lib/module/SceneView.js +7 -40
  18. package/lib/module/SceneView.js.map +1 -1
  19. package/lib/module/StaticNavigation.js +179 -50
  20. package/lib/module/StaticNavigation.js.map +1 -1
  21. package/lib/module/StaticTreeContext.js +5 -0
  22. package/lib/module/StaticTreeContext.js.map +1 -0
  23. package/lib/module/checkSerializable.js +18 -13
  24. package/lib/module/checkSerializable.js.map +1 -1
  25. package/lib/module/createNavigationContainerRef.js +6 -8
  26. package/lib/module/createNavigationContainerRef.js.map +1 -1
  27. package/lib/module/createNavigatorFactory.js +27 -5
  28. package/lib/module/createNavigatorFactory.js.map +1 -1
  29. package/lib/module/findFocusedRoute.js +7 -4
  30. package/lib/module/findFocusedRoute.js.map +1 -1
  31. package/lib/module/getActionFromState.js +45 -20
  32. package/lib/module/getActionFromState.js.map +1 -1
  33. package/lib/module/getPathFromState.js +171 -90
  34. package/lib/module/getPathFromState.js.map +1 -1
  35. package/lib/module/getPatternParts.js +20 -4
  36. package/lib/module/getPatternParts.js.map +1 -1
  37. package/lib/module/getStateFromPath.js +485 -214
  38. package/lib/module/getStateFromPath.js.map +1 -1
  39. package/lib/module/getStateFromRouteParams.js +24 -0
  40. package/lib/module/getStateFromRouteParams.js.map +1 -0
  41. package/lib/module/index.js +5 -4
  42. package/lib/module/index.js.map +1 -1
  43. package/lib/module/theming/useTheme.js +1 -1
  44. package/lib/module/theming/useTheme.js.map +1 -1
  45. package/lib/module/types.js +35 -0
  46. package/lib/module/types.js.map +1 -1
  47. package/lib/module/useDescriptors.js +19 -11
  48. package/lib/module/useDescriptors.js.map +1 -1
  49. package/lib/module/useEventEmitter.js +48 -33
  50. package/lib/module/useEventEmitter.js.map +1 -1
  51. package/lib/module/useFocusEvents.js +12 -4
  52. package/lib/module/useFocusEvents.js.map +1 -1
  53. package/lib/module/useFocusedListenersChildrenAdapter.js +2 -2
  54. package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
  55. package/lib/module/useIsFocused.js +7 -12
  56. package/lib/module/useIsFocused.js.map +1 -1
  57. package/lib/module/useKeyedChildListeners.js +4 -2
  58. package/lib/module/useKeyedChildListeners.js.map +1 -1
  59. package/lib/module/useLazyValue.js.map +1 -1
  60. package/lib/module/useNavigation.js +2 -15
  61. package/lib/module/useNavigation.js.map +1 -1
  62. package/lib/module/useNavigationBuilder.js +201 -131
  63. package/lib/module/useNavigationBuilder.js.map +1 -1
  64. package/lib/module/useNavigationCache.js +22 -17
  65. package/lib/module/useNavigationCache.js.map +1 -1
  66. package/lib/module/useNavigationHelpers.js +28 -10
  67. package/lib/module/useNavigationHelpers.js.map +1 -1
  68. package/lib/module/useNavigationIndependentTree.js +1 -1
  69. package/lib/module/useNavigationIndependentTree.js.map +1 -1
  70. package/lib/module/useNavigationState.js +70 -35
  71. package/lib/module/useNavigationState.js.map +1 -1
  72. package/lib/module/useOnAction.js +37 -7
  73. package/lib/module/useOnAction.js.map +1 -1
  74. package/lib/module/useOnGetState.js +6 -3
  75. package/lib/module/useOnGetState.js.map +1 -1
  76. package/lib/module/useOnPreventRemove.js +39 -30
  77. package/lib/module/useOnPreventRemove.js.map +1 -1
  78. package/lib/module/useOnRouteFocus.js +1 -1
  79. package/lib/module/useOnRouteFocus.js.map +1 -1
  80. package/lib/module/useOptionsGetters.js +10 -5
  81. package/lib/module/useOptionsGetters.js.map +1 -1
  82. package/lib/module/usePreventRemove.js +10 -3
  83. package/lib/module/usePreventRemove.js.map +1 -1
  84. package/lib/module/usePreventRemoveContext.js +1 -1
  85. package/lib/module/usePreventRemoveContext.js.map +1 -1
  86. package/lib/module/useRegisterNavigator.js +2 -2
  87. package/lib/module/useRegisterNavigator.js.map +1 -1
  88. package/lib/module/useRoute.js +2 -0
  89. package/lib/module/useRoute.js.map +1 -1
  90. package/lib/module/useRouteCache.js +17 -11
  91. package/lib/module/useRouteCache.js.map +1 -1
  92. package/lib/module/useScheduleUpdate.js +9 -9
  93. package/lib/module/useScheduleUpdate.js.map +1 -1
  94. package/lib/module/useStateForPath.js +1 -1
  95. package/lib/module/useStateForPath.js.map +1 -1
  96. package/lib/module/useSyncState.js +7 -3
  97. package/lib/module/useSyncState.js.map +1 -1
  98. package/lib/module/validatePathConfig.js +50 -36
  99. package/lib/module/validatePathConfig.js.map +1 -1
  100. package/lib/typescript/src/BaseNavigationContainer.d.ts +6 -3
  101. package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
  102. package/lib/typescript/src/ConsumedParamsContext.d.ts +3 -0
  103. package/lib/typescript/src/ConsumedParamsContext.d.ts.map +1 -0
  104. package/lib/typescript/src/DataLoading.d.ts +21 -0
  105. package/lib/typescript/src/DataLoading.d.ts.map +1 -0
  106. package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -1
  107. package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
  108. package/lib/typescript/src/Group.d.ts +1 -1
  109. package/lib/typescript/src/Group.d.ts.map +1 -1
  110. package/lib/typescript/src/NavigationBuilderContext.d.ts +9 -8
  111. package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -1
  112. package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -1
  113. package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -1
  114. package/lib/typescript/src/NavigationFocusedRouteStateContext.d.ts +4 -4
  115. package/lib/typescript/src/NavigationFocusedRouteStateContext.d.ts.map +1 -1
  116. package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -1
  117. package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -1
  118. package/lib/typescript/src/NavigationIndependentTree.d.ts +1 -1
  119. package/lib/typescript/src/NavigationIndependentTree.d.ts.map +1 -1
  120. package/lib/typescript/src/NavigationProvider.d.ts +12 -13
  121. package/lib/typescript/src/NavigationProvider.d.ts.map +1 -1
  122. package/lib/typescript/src/NavigationStateContext.d.ts +3 -3
  123. package/lib/typescript/src/NavigationStateContext.d.ts.map +1 -1
  124. package/lib/typescript/src/PreventRemoveContext.d.ts +1 -0
  125. package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -1
  126. package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -1
  127. package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
  128. package/lib/typescript/src/SceneView.d.ts +3 -2
  129. package/lib/typescript/src/SceneView.d.ts.map +1 -1
  130. package/lib/typescript/src/Screen.d.ts +1 -1
  131. package/lib/typescript/src/Screen.d.ts.map +1 -1
  132. package/lib/typescript/src/StaticContainer.d.ts +1 -1
  133. package/lib/typescript/src/StaticContainer.d.ts.map +1 -1
  134. package/lib/typescript/src/StaticNavigation.d.ts +189 -109
  135. package/lib/typescript/src/StaticNavigation.d.ts.map +1 -1
  136. package/lib/typescript/src/StaticTreeContext.d.ts +4 -0
  137. package/lib/typescript/src/StaticTreeContext.d.ts.map +1 -0
  138. package/lib/typescript/src/checkSerializable.d.ts +8 -4
  139. package/lib/typescript/src/checkSerializable.d.ts.map +1 -1
  140. package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -1
  141. package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -1
  142. package/lib/typescript/src/createNavigatorFactory.d.ts +23 -5
  143. package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -1
  144. package/lib/typescript/src/findFocusedRoute.d.ts +3 -3
  145. package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -1
  146. package/lib/typescript/src/getActionFromState.d.ts +4 -4
  147. package/lib/typescript/src/getActionFromState.d.ts.map +1 -1
  148. package/lib/typescript/src/getPathFromState.d.ts +3 -3
  149. package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
  150. package/lib/typescript/src/getPatternParts.d.ts +1 -0
  151. package/lib/typescript/src/getPatternParts.d.ts.map +1 -1
  152. package/lib/typescript/src/getStateFromPath.d.ts +5 -5
  153. package/lib/typescript/src/getStateFromPath.d.ts.map +1 -1
  154. package/lib/typescript/src/getStateFromRouteParams.d.ts +3 -0
  155. package/lib/typescript/src/getStateFromRouteParams.d.ts.map +1 -0
  156. package/lib/typescript/src/index.d.ts +36 -33
  157. package/lib/typescript/src/index.d.ts.map +1 -1
  158. package/lib/typescript/src/theming/ThemeContext.d.ts +1 -1
  159. package/lib/typescript/src/theming/ThemeContext.d.ts.map +1 -1
  160. package/lib/typescript/src/theming/ThemeProvider.d.ts +2 -2
  161. package/lib/typescript/src/theming/ThemeProvider.d.ts.map +1 -1
  162. package/lib/typescript/src/theming/useTheme.d.ts +1 -1
  163. package/lib/typescript/src/theming/useTheme.d.ts.map +1 -1
  164. package/lib/typescript/src/types.d.ts +260 -159
  165. package/lib/typescript/src/types.d.ts.map +1 -1
  166. package/lib/typescript/src/useChildListeners.d.ts +3 -3
  167. package/lib/typescript/src/useChildListeners.d.ts.map +1 -1
  168. package/lib/typescript/src/useComponent.d.ts +1 -1
  169. package/lib/typescript/src/useComponent.d.ts.map +1 -1
  170. package/lib/typescript/src/useDescriptors.d.ts +8 -8
  171. package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
  172. package/lib/typescript/src/useEventEmitter.d.ts +2 -2
  173. package/lib/typescript/src/useEventEmitter.d.ts.map +1 -1
  174. package/lib/typescript/src/useFocusEvents.d.ts +2 -2
  175. package/lib/typescript/src/useFocusEvents.d.ts.map +1 -1
  176. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +2 -2
  177. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
  178. package/lib/typescript/src/useIsFocused.d.ts +3 -0
  179. package/lib/typescript/src/useIsFocused.d.ts.map +1 -1
  180. package/lib/typescript/src/useKeyedChildListeners.d.ts +3 -3
  181. package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -1
  182. package/lib/typescript/src/useLazyValue.d.ts.map +1 -1
  183. package/lib/typescript/src/useNavigation.d.ts +4 -2
  184. package/lib/typescript/src/useNavigation.d.ts.map +1 -1
  185. package/lib/typescript/src/useNavigationBuilder.d.ts +23 -30
  186. package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
  187. package/lib/typescript/src/useNavigationCache.d.ts +3 -3
  188. package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
  189. package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -1
  190. package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -1
  191. package/lib/typescript/src/useNavigationHelpers.d.ts +19 -27
  192. package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
  193. package/lib/typescript/src/useNavigationState.d.ts +13 -3
  194. package/lib/typescript/src/useNavigationState.d.ts.map +1 -1
  195. package/lib/typescript/src/useOnAction.d.ts +9 -9
  196. package/lib/typescript/src/useOnAction.d.ts.map +1 -1
  197. package/lib/typescript/src/useOnGetState.d.ts +1 -1
  198. package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
  199. package/lib/typescript/src/useOnPreventRemove.d.ts +5 -9
  200. package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
  201. package/lib/typescript/src/useOnRouteFocus.d.ts +6 -6
  202. package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -1
  203. package/lib/typescript/src/useOptionsGetters.d.ts +1 -1
  204. package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
  205. package/lib/typescript/src/usePreventRemove.d.ts.map +1 -1
  206. package/lib/typescript/src/usePreventRemoveContext.d.ts +2 -1
  207. package/lib/typescript/src/usePreventRemoveContext.d.ts.map +1 -1
  208. package/lib/typescript/src/useRoute.d.ts +7 -3
  209. package/lib/typescript/src/useRoute.d.ts.map +1 -1
  210. package/lib/typescript/src/useRouteCache.d.ts +5 -5
  211. package/lib/typescript/src/useRouteCache.d.ts.map +1 -1
  212. package/lib/typescript/src/useScheduleUpdate.d.ts +5 -4
  213. package/lib/typescript/src/useScheduleUpdate.d.ts.map +1 -1
  214. package/lib/typescript/src/useStateForPath.d.ts +1 -1
  215. package/lib/typescript/src/useStateForPath.d.ts.map +1 -1
  216. package/lib/typescript/src/useSyncState.d.ts.map +1 -1
  217. package/lib/typescript/src/utilities.d.ts +74 -37
  218. package/lib/typescript/src/utilities.d.ts.map +1 -1
  219. package/lib/typescript/src/validatePathConfig.d.ts.map +1 -1
  220. package/package.json +23 -22
  221. package/src/BaseNavigationContainer.tsx +351 -333
  222. package/src/ConsumedParamsContext.tsx +5 -0
  223. package/src/DataLoading.tsx +203 -0
  224. package/src/NavigationBuilderContext.tsx +14 -9
  225. package/src/NavigationFocusedRouteStateContext.tsx +4 -4
  226. package/src/NavigationIndependentTree.tsx +18 -12
  227. package/src/NavigationProvider.tsx +26 -15
  228. package/src/NavigationStateContext.tsx +5 -6
  229. package/src/PreventRemoveContext.tsx +1 -0
  230. package/src/PreventRemoveProvider.tsx +51 -46
  231. package/src/SceneView.tsx +7 -39
  232. package/src/StaticNavigation.tsx +659 -307
  233. package/src/StaticTreeContext.tsx +7 -0
  234. package/src/checkSerializable.tsx +35 -19
  235. package/src/createNavigationContainerRef.tsx +12 -9
  236. package/src/createNavigatorFactory.tsx +92 -8
  237. package/src/findFocusedRoute.tsx +13 -8
  238. package/src/getActionFromState.tsx +86 -51
  239. package/src/getPathFromState.tsx +254 -128
  240. package/src/getPatternParts.tsx +25 -4
  241. package/src/getStateFromPath.tsx +811 -309
  242. package/src/getStateFromRouteParams.tsx +60 -0
  243. package/src/index.tsx +55 -5
  244. package/src/theming/useTheme.tsx +1 -1
  245. package/src/types.tsx +798 -373
  246. package/src/useDescriptors.tsx +28 -14
  247. package/src/useEventEmitter.tsx +52 -38
  248. package/src/useFocusEvents.tsx +15 -7
  249. package/src/useFocusedListenersChildrenAdapter.tsx +2 -2
  250. package/src/useIsFocused.tsx +14 -21
  251. package/src/useKeyedChildListeners.tsx +4 -2
  252. package/src/useLazyValue.tsx +2 -2
  253. package/src/useNavigation.tsx +7 -24
  254. package/src/useNavigationBuilder.tsx +311 -186
  255. package/src/useNavigationCache.tsx +32 -25
  256. package/src/useNavigationHelpers.tsx +27 -10
  257. package/src/useNavigationIndependentTree.tsx +1 -1
  258. package/src/useNavigationState.tsx +93 -59
  259. package/src/useOnAction.tsx +61 -13
  260. package/src/useOnGetState.tsx +5 -3
  261. package/src/useOnPreventRemove.tsx +75 -42
  262. package/src/useOnRouteFocus.tsx +10 -12
  263. package/src/useOptionsGetters.tsx +11 -5
  264. package/src/usePreventRemove.tsx +12 -3
  265. package/src/usePreventRemoveContext.tsx +1 -1
  266. package/src/useRegisterNavigator.tsx +2 -2
  267. package/src/useRoute.tsx +20 -6
  268. package/src/useRouteCache.tsx +22 -16
  269. package/src/useScheduleUpdate.tsx +9 -10
  270. package/src/useStateForPath.tsx +1 -1
  271. package/src/useSyncState.tsx +8 -3
  272. package/src/utilities.tsx +144 -31
  273. package/src/validatePathConfig.tsx +86 -57
  274. package/lib/module/CurrentRenderContext.js +0 -10
  275. package/lib/module/CurrentRenderContext.js.map +0 -1
  276. package/lib/module/useCurrentRender.js +0 -19
  277. package/lib/module/useCurrentRender.js.map +0 -1
  278. package/lib/typescript/src/CurrentRenderContext.d.ts +0 -9
  279. package/lib/typescript/src/CurrentRenderContext.d.ts.map +0 -1
  280. package/lib/typescript/src/useCurrentRender.d.ts +0 -14
  281. package/lib/typescript/src/useCurrentRender.d.ts.map +0 -1
  282. package/src/CurrentRenderContext.tsx +0 -9
  283. package/src/useCurrentRender.tsx +0 -31
@@ -1,6 +1,6 @@
1
1
  import type { DefaultRouterOptions, InitialState, NavigationAction, NavigationState, ParamListBase, PartialState, Route, Router } from '@react-navigation/routers';
2
2
  import type * as React from 'react';
3
- import type { FlatType, KeyOf, NotUndefined, UnionToIntersection } from './utilities';
3
+ import type { FlatType, KeyOf, NotUndefined, StandardSchemaV1, UnionToIntersection } from './utilities.js';
4
4
  /**
5
5
  * Root navigator used in the app.
6
6
  * It's used for the global types in the app.
@@ -35,7 +35,12 @@ export interface RootNavigator {
35
35
  */
36
36
  export interface Theme {
37
37
  }
38
- export type RootParamList = RootNavigator extends TypedNavigatorInternal<infer ParamList, any, any, any, any, any> ? ParamList : {};
38
+ export type RootParamList = RootNavigator extends PrivateValueStore<[
39
+ infer ParamList extends {},
40
+ any,
41
+ any,
42
+ any
43
+ ]> ? ParamList : {};
39
44
  export type DefaultNavigatorOptions<ParamList extends ParamListBase, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, Navigation> = DefaultRouterOptions<KeyOf<ParamList>> & {
40
45
  /**
41
46
  * Children React Elements to extract the route configuration from.
@@ -46,31 +51,31 @@ export type DefaultNavigatorOptions<ParamList extends ParamListBase, State exten
46
51
  * Layout for the navigator.
47
52
  * Useful for wrapping with a component with access to navigator's state and options.
48
53
  */
49
- layout?: (props: {
54
+ layout?: ((props: {
50
55
  state: State;
51
56
  navigation: NavigationHelpers<ParamList>;
52
- descriptors: Record<string, Descriptor<ScreenOptions, NavigationProp<ParamList, keyof ParamList, State, ScreenOptions, EventMap>, RouteProp<ParamList>>>;
57
+ descriptors: Record<string, Descriptor<ScreenOptions, NavigationProp<ParamList, keyof ParamList, State, ScreenOptions, EventMap>, ScreenRouteProp<ParamList>>>;
53
58
  children: React.ReactNode;
54
- }) => React.ReactElement;
59
+ }) => React.ReactElement) | undefined;
55
60
  /**
56
61
  * Event listeners for all the screens in the navigator.
57
62
  */
58
- screenListeners?: ScreenListeners<State, EventMap> | ((props: {
59
- route: RouteProp<ParamList>;
63
+ screenListeners?: (ScreenListeners<State, EventMap> | ((props: {
64
+ route: ScreenRouteProp<ParamList>;
60
65
  navigation: Navigation;
61
- }) => ScreenListeners<State, EventMap>);
66
+ }) => ScreenListeners<State, EventMap>)) | undefined;
62
67
  /**
63
68
  * Default options for all screens under this navigator.
64
69
  */
65
- screenOptions?: ScreenOptions | ((props: {
66
- route: RouteProp<ParamList>;
70
+ screenOptions?: (ScreenOptions | ((props: {
71
+ route: ScreenRouteProp<ParamList>;
67
72
  navigation: Navigation;
68
73
  theme: Theme;
69
- }) => ScreenOptions);
74
+ }) => ScreenOptions)) | undefined;
70
75
  /**
71
76
  * Layout for all screens under this navigator.
72
77
  */
73
- screenLayout?: (props: ScreenLayoutArgs<ParamList, keyof ParamList, ScreenOptions, Navigation>) => React.ReactElement;
78
+ screenLayout?: ((props: ScreenLayoutArgs<ParamList, keyof ParamList, ScreenOptions, Navigation>) => React.ReactElement) | undefined;
74
79
  /**
75
80
  * A function returning overrides for the underlying router used by the navigator.
76
81
  * The overrides will be shallow merged onto the original router.
@@ -78,7 +83,7 @@ export type DefaultNavigatorOptions<ParamList extends ParamListBase, State exten
78
83
  *
79
84
  * This must be a pure function and cannot reference outside dynamic variables.
80
85
  */
81
- router?: <Action extends NavigationAction>(original: Router<State, Action>) => Partial<Router<State, Action>>;
86
+ router?: (<Action extends NavigationAction>(original: Router<State, Action>) => Partial<Router<State, Action>>) | undefined;
82
87
  /**
83
88
  * What should happen when the available route names change.
84
89
  * e.g. when different screens are rendered based on a condition.
@@ -98,13 +103,13 @@ export type DefaultNavigatorOptions<ParamList extends ParamListBase, State exten
98
103
  * - Direct navigation is only handled for `NAVIGATE` actions.
99
104
  * - Unhandled state is restored only if the current state becomes invalid, i.e. it doesn't contain any currently defined screens.
100
105
  */
101
- routeNamesChangeBehavior?: 'firstMatch' | 'lastUnhandled';
106
+ routeNamesChangeBehavior?: ('firstMatch' | 'lastUnhandled') | undefined;
102
107
  };
103
108
  export type EventMapBase = Record<string, {
104
109
  data?: any;
105
- canPreventDefault?: boolean;
110
+ canPreventDefault?: boolean | undefined;
106
111
  }>;
107
- export type EventMapCore<State extends NavigationState> = {
112
+ export type EventMapCore<in out State extends NavigationState> = {
108
113
  focus: {
109
114
  data: undefined;
110
115
  };
@@ -131,7 +136,7 @@ export type EventArg<EventName, CanPreventDefault extends boolean | undefined =
131
136
  /**
132
137
  * Key of the route which received the event.
133
138
  */
134
- readonly target?: string;
139
+ readonly target?: string | undefined;
135
140
  } & (CanPreventDefault extends true ? {
136
141
  /**
137
142
  * Whether `event.preventDefault()` was called on this event object.
@@ -142,12 +147,12 @@ export type EventArg<EventName, CanPreventDefault extends boolean | undefined =
142
147
  */
143
148
  preventDefault(): void;
144
149
  } : {}) & (undefined extends Data ? {
145
- readonly data?: Readonly<Data>;
150
+ readonly data?: Readonly<Data> | undefined;
146
151
  } : {
147
152
  readonly data: Readonly<Data>;
148
153
  });
149
- export type EventListenerCallback<EventMap extends EventMapBase, EventName extends keyof EventMap, EventCanPreventDefault extends boolean | undefined = EventMap[EventName]['canPreventDefault']> = (e: EventArg<EventName, undefined extends EventCanPreventDefault ? false : EventCanPreventDefault, EventMap[EventName]['data']>) => void;
150
- export type EventConsumer<EventMap extends EventMapBase> = {
154
+ export type EventListenerCallback<in out EventMap extends EventMapBase, in out EventName extends keyof EventMap, in out EventCanPreventDefault extends boolean | undefined = EventMap[EventName]['canPreventDefault']> = (e: EventArg<EventName, undefined extends EventCanPreventDefault ? false : EventCanPreventDefault, EventMap[EventName]['data']>) => void;
155
+ export type EventConsumer<in out EventMap extends EventMapBase> = {
151
156
  /**
152
157
  * Subscribe to events from the parent navigator.
153
158
  *
@@ -157,7 +162,7 @@ export type EventConsumer<EventMap extends EventMapBase> = {
157
162
  addListener<EventName extends KeyOf<EventMap>>(type: EventName, callback: EventListenerCallback<EventMap, EventName>): () => void;
158
163
  removeListener<EventName extends KeyOf<EventMap>>(type: EventName, callback: EventListenerCallback<EventMap, EventName>): void;
159
164
  };
160
- export type EventEmitter<EventMap extends EventMapBase> = {
165
+ export type EventEmitter<in out EventMap extends EventMapBase> = {
161
166
  /**
162
167
  * Emit an event to child screens.
163
168
  *
@@ -177,7 +182,7 @@ export type EventEmitter<EventMap extends EventMapBase> = {
177
182
  data: EventMap[EventName]['data'];
178
183
  })): EventArg<EventName, EventMap[EventName]['canPreventDefault'], EventMap[EventName]['data']>;
179
184
  };
180
- export declare class PrivateValueStore<T extends [any, any, any]> {
185
+ export declare class PrivateValueStore<T extends [any, any, any, any]> {
181
186
  /**
182
187
  * UGLY HACK! DO NOT USE THE TYPE!!!
183
188
  *
@@ -190,6 +195,25 @@ export declare class PrivateValueStore<T extends [any, any, any]> {
190
195
  */
191
196
  protected ''?: T;
192
197
  }
198
+ type NavigatorLike = {
199
+ Navigator: React.ComponentType<any>;
200
+ Screen: unknown;
201
+ Group: unknown;
202
+ } | {
203
+ config: unknown;
204
+ getComponent: () => React.ComponentType<any>;
205
+ };
206
+ export type ParamListForNavigator<T extends {}> = T extends NavigatorLike ? T extends PrivateValueStore<[infer ParamList extends {}, any, any, any]> ? ParamList : T : T;
207
+ type NestedNavigatorForScreenParams<T, Params = NotUndefined<T>> = [
208
+ Params
209
+ ] extends [never] ? never : Params extends NavigatorScreenParams<infer Navigator> ? Navigator extends PrivateValueStore<[any, any, any, any]> ? Navigator extends NavigatorLike ? Navigator : never : never : never;
210
+ export type NestedNavigatorsForParamList<ParamList extends {}> = {
211
+ [RouteName in keyof ParamList as NestedNavigatorForScreenParams<ParamList[RouteName]> extends never ? never : RouteName]: NestedNavigatorForScreenParams<ParamList[RouteName]>;
212
+ };
213
+ type NavigateOptions = {
214
+ merge?: boolean | undefined;
215
+ pop?: boolean | undefined;
216
+ };
193
217
  type NavigationHelpersCommon<ParamList extends ParamListBase, State extends NavigationState = NavigationState> = {
194
218
  /**
195
219
  * Dispatch an action or an update function to the router.
@@ -210,34 +234,12 @@ type NavigationHelpersCommon<ParamList extends ParamListBase, State extends Navi
210
234
  navigate<RouteName extends keyof ParamList>(...args: RouteName extends unknown ? undefined extends ParamList[RouteName] ? [
211
235
  screen: RouteName,
212
236
  params?: ParamList[RouteName],
213
- options?: {
214
- merge?: boolean;
215
- pop?: boolean;
216
- }
237
+ options?: NavigateOptions
217
238
  ] : [
218
239
  screen: RouteName,
219
240
  params: ParamList[RouteName],
220
- options?: {
221
- merge?: boolean;
222
- pop?: boolean;
223
- }
241
+ options?: NavigateOptions
224
242
  ] : never): void;
225
- /**
226
- * Navigate to a route in current navigation tree.
227
- *
228
- * @param options.name Name of the route to navigate to.
229
- * @param [options.params] Params object for the route.
230
- * @param [options.path] Path to associate the route with (e.g. for deep links).
231
- * @param [options.merge] Whether to merge the params onto the route. Defaults to `false`.
232
- * @param [options.pop] Whether to pop routes in a stack to go back to the matching route. Defaults to `false`.
233
- */
234
- navigate<RouteName extends keyof ParamList>(options: RouteName extends unknown ? {
235
- name: RouteName;
236
- params: ParamList[RouteName];
237
- path?: string;
238
- merge?: boolean;
239
- pop?: boolean;
240
- } : never): void;
241
243
  /**
242
244
  * Preloads the route in current navigation tree.
243
245
  *
@@ -277,9 +279,9 @@ type NavigationHelpersCommon<ParamList extends ParamListBase, State extends Navi
277
279
  * So don't use it in `render`.
278
280
  */
279
281
  getState(): State;
280
- } & PrivateValueStore<[ParamList, unknown, unknown]>;
281
- type ParamType<ParamList extends {}, RouteName extends keyof ParamList | unknown, IsPartial extends boolean = false> = RouteName extends keyof ParamList ? ParamList[RouteName] extends undefined ? undefined : IsPartial extends true ? Partial<ParamList[RouteName]> : ParamList[RouteName] : unknown;
282
- type NavigationHelpersRoute<ParamList extends {}, RouteName extends keyof ParamList = KeyOf<ParamList>> = {
282
+ };
283
+ type ParamType<ParamList extends {}, RouteName, IsPartial extends boolean = false> = RouteName extends keyof ParamList ? ParamList[RouteName] extends undefined ? undefined : IsPartial extends true ? Partial<ParamList[RouteName]> : ParamList[RouteName] : unknown;
284
+ type NavigationHelpersRoute<in out ParamList extends {}, in out RouteName extends keyof ParamList = KeyOf<ParamList>> = {
283
285
  /**
284
286
  * Update the param object for the route.
285
287
  * The new params will be shallow merged with the old one.
@@ -302,34 +304,34 @@ type NavigationHelpersRoute<ParamList extends {}, RouteName extends keyof ParamL
302
304
  */
303
305
  pushParams(params: ParamType<ParamList, RouteName>): void;
304
306
  };
305
- export type NavigationHelpers<ParamList extends ParamListBase, EventMap extends EventMapBase = {}> = NavigationHelpersCommon<ParamList> & EventEmitter<EventMap> & NavigationHelpersRoute<ParamList, keyof ParamList>;
307
+ export type NavigationHelpers<ParamList extends ParamListBase, EventMap extends EventMapBase = {}> = NavigationHelpersCommon<ParamList> & EventEmitter<EventMap> & NavigationHelpersRoute<ParamList, keyof ParamList> & PrivateValueStore<[ParamList, unknown, unknown, unknown]>;
306
308
  export type NavigationContainerProps = {
307
309
  /**
308
310
  * Initial state object for the navigation tree.
309
311
  */
310
- initialState?: InitialState;
312
+ initialState?: InitialState | undefined;
311
313
  /**
312
314
  * Callback which is called with the latest navigation state when it changes.
313
315
  */
314
- onStateChange?: (state: Readonly<NavigationState> | undefined) => void;
316
+ onStateChange?: ((state: Readonly<NavigationState> | undefined) => void) | undefined;
315
317
  /**
316
318
  * Callback which is called after the navigation tree mounts.
317
319
  */
318
- onReady?: () => void;
320
+ onReady?: (() => void) | undefined;
319
321
  /**
320
322
  * Callback which is called when an action is not handled.
321
323
  */
322
- onUnhandledAction?: (action: Readonly<NavigationAction>) => void;
324
+ onUnhandledAction?: ((action: Readonly<NavigationAction>) => void) | undefined;
323
325
  /**
324
326
  * Theme object for the UI elements.
325
327
  */
326
- theme?: Theme;
328
+ theme?: Theme | undefined;
327
329
  /**
328
330
  * Children elements to render.
329
331
  */
330
332
  children: React.ReactNode;
331
333
  };
332
- export type NavigationProp<ParamList extends {}, RouteName extends keyof ParamList = KeyOf<ParamList>, State extends NavigationState = NavigationState<ParamList>, ScreenOptions extends {} = {}, EventMap extends EventMapBase = {}, ActionHelpers extends Record<string, (...args: any) => void> = {}> = Omit<NavigationHelpersCommon<ParamList, State>, 'getParent'> & {
334
+ type NavigationPropBase<ParamList extends {}, RouteName extends keyof ParamList = KeyOf<ParamList>, State extends NavigationState = NavigationState<ParamList>, ScreenOptions extends {} = {}, EventMap extends EventMapBase = {}, ActionHelpers extends Record<string, (...args: any) => void> = {}> = NavigationHelpersCommon<ParamList, State> & {
333
335
  /**
334
336
  * Update the options for the route.
335
337
  * The options object will be shallow merged with default options object.
@@ -337,6 +339,8 @@ export type NavigationProp<ParamList extends {}, RouteName extends keyof ParamLi
337
339
  * @param options Partial options object for the current screen.
338
340
  */
339
341
  setOptions(options: Partial<ScreenOptions>): void;
342
+ } & NavigationHelpersRoute<ParamList, RouteName> & ActionHelpers & EventConsumer<EventMap & EventMapCore<State>>;
343
+ export type NavigationProp<ParamList extends {}, RouteName extends keyof ParamList = KeyOf<ParamList>, State extends NavigationState = NavigationState<ParamList>, ScreenOptions extends {} = {}, EventMap extends EventMapBase = {}, ActionHelpers extends Record<string, (...args: any) => void> = {}> = NavigationPropBase<ParamList, RouteName, State, ScreenOptions, EventMap, ActionHelpers> & {
340
344
  /**
341
345
  * Returns the navigation prop of the parent screen.
342
346
  * If a route name is provided, the navigation prop from the parent screen with matching route name (including current) will be returned.
@@ -346,51 +350,62 @@ export type NavigationProp<ParamList extends {}, RouteName extends keyof ParamLi
346
350
  */
347
351
  getParent(routeName: RouteName): NavigationProp<ParamList, RouteName, State, ScreenOptions, EventMap, ActionHelpers>;
348
352
  getParent(): NavigationProp<ParamListBase> | undefined;
349
- } & NavigationHelpersRoute<ParamList, RouteName> & ActionHelpers & EventConsumer<EventMap & EventMapCore<State>> & PrivateValueStore<[ParamList, RouteName, EventMap]>;
350
- export type RouteProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = KeyOf<ParamList>> = Route<Extract<RouteName, string>, ParamList[RouteName]>;
351
- export type CompositeNavigationProp<A extends NavigationProp<ParamListBase, any, any, any, any>, B extends NavigationProp<ParamListBase, any, any, any, any>> = Omit<A & B, keyof NavigationProp<any, any, any, any, any>> & Omit<NavigationProp<
353
+ } & PrivateValueStore<[ParamList, RouteName, EventMap, ActionHelpers]>;
354
+ export type RouteProp<in out ParamList extends ParamListBase, in out RouteName extends keyof ParamList = KeyOf<ParamList>> = Route<Extract<RouteName, string>, ParamList[RouteName]>;
355
+ type ScreenRouteProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = KeyOf<ParamList>> = {
356
+ [Name in Extract<RouteName, string>]: RouteProp<ParamList, Name>;
357
+ }[Extract<RouteName, string>];
358
+ export type CompositeNavigationProp<A extends NavigationProp<ParamListBase, any, any, any, any>, B extends NavigationProp<ParamListBase, any, any, any, any>> = CompositeNavigationPropInternal<A, B,
352
359
  /**
353
360
  * Param list from both navigation objects needs to be combined
354
361
  * For example, we should be able to navigate to screens in both A and B
355
362
  */
356
- (A extends NavigationHelpersCommon<infer T> ? T : never) & (B extends NavigationHelpersCommon<infer U> ? U : never),
363
+ ParamListOfNavigationProp<A> & ParamListOfNavigationProp<B>,
357
364
  /**
358
365
  * The route name should refer to the route name specified in the first type
359
- * Ideally it should work for any of them, but it's not possible to infer that way
360
366
  */
361
- A extends NavigationProp<any, infer R> ? R : string,
367
+ RouteNameOfNavigationProp<A>,
362
368
  /**
363
- * The type of state should refer to the state specified in the first type
369
+ * Event map should refer to the config specified in the first type
364
370
  */
365
- A extends NavigationProp<any, any, infer S> ? S : NavigationState,
366
- /**
367
- * Screen options should refer to the options specified in the first type
368
- */
369
- A extends NavigationProp<any, any, any, infer O> ? O : {},
370
- /**
371
- * Event consumer config should refer to the config specified in the first type
372
- * This allows typechecking `addListener`/`removeListener`
373
- */
374
- A extends NavigationProp<any, any, any, any, infer E> ? E : {}>, 'getParent'> & {
371
+ EventMapOfNavigationProp<A>>;
372
+ type CompositeNavigationPropInternal<A extends NavigationProp<ParamListBase, any, any, any, any>, B extends NavigationProp<ParamListBase, any, any, any, any>, ParamList extends {}, RouteName extends keyof ParamList, EventMap extends EventMapBase> = // Action helpers are read from the private brand (4th slot) instead of
373
+ ActionHelpersOfNavigationProp<A> & ActionHelpersOfNavigationProp<B> & NavigationPropBase<ParamList, RouteName, StateOfNavigationProp<A>, ScreenOptionsOfNavigationProp<A>, EventMap> & {
375
374
  getParent: A['getParent'] & B['getParent'];
376
- };
377
- export type CompositeScreenProps<A extends {
375
+ } & PrivateValueStore<[
376
+ ParamList,
377
+ RouteName,
378
+ EventMap,
379
+ ActionHelpersOfNavigationProp<A> & ActionHelpersOfNavigationProp<B>
380
+ ]>;
381
+ type PrivateValueOfNavigationProp<T> = T extends PrivateValueStore<infer Value> ? Value : [never, unknown, {}, {}];
382
+ type ParamListOfNavigationProp<T> = PrivateValueOfNavigationProp<T>[0];
383
+ type RouteNameOfNavigationProp<T> = PrivateValueOfNavigationProp<T>[1];
384
+ type ActionHelpersOfNavigationProp<T> = PrivateValueOfNavigationProp<T>[3];
385
+ type StateOfNavigationProp<T> = T extends {
386
+ getState: () => infer State extends NavigationState;
387
+ } ? State : NavigationState;
388
+ type ScreenOptionsOfNavigationProp<T> = T extends {
389
+ setOptions: (options: Partial<infer ScreenOptions>) => void;
390
+ } ? ScreenOptions : {};
391
+ type EventMapOfNavigationProp<T> = PrivateValueOfNavigationProp<T>[2];
392
+ export type CompositeScreenProps<in out A extends {
378
393
  navigation: NavigationProp<ParamListBase, string, any, any, any>;
379
394
  route: RouteProp<ParamListBase>;
380
- }, B extends {
395
+ }, in out B extends {
381
396
  navigation: NavigationProp<ParamListBase, string, any, any, any>;
382
397
  }> = {
383
398
  navigation: CompositeNavigationProp<A['navigation'], B['navigation']>;
384
399
  route: A['route'];
385
400
  };
386
- export type ScreenLayoutArgs<ParamList extends ParamListBase, RouteName extends keyof ParamList, ScreenOptions extends {}, Navigation> = {
387
- route: RouteProp<ParamList, RouteName>;
401
+ export type ScreenLayoutArgs<in out ParamList extends ParamListBase, in out RouteName extends keyof ParamList, in out ScreenOptions extends {}, in out Navigation> = {
402
+ route: ScreenRouteProp<ParamList, RouteName>;
388
403
  options: ScreenOptions;
389
404
  navigation: Navigation;
390
405
  theme: Theme;
391
406
  children: React.ReactElement;
392
407
  };
393
- export type Descriptor<ScreenOptions extends {}, Navigation extends NavigationProp<any, any, any, any, any>, Route extends RouteProp<any, any>> = {
408
+ export type Descriptor<out ScreenOptions extends {}, out Navigation extends NavigationProp<ParamListBase, any, any, any, any>, out Route extends RouteProp<any, any>> = {
394
409
  /**
395
410
  * Render the component associated with this route.
396
411
  */
@@ -408,7 +423,7 @@ export type Descriptor<ScreenOptions extends {}, Navigation extends NavigationPr
408
423
  */
409
424
  navigation: Navigation;
410
425
  };
411
- export type ScreenListeners<State extends NavigationState, EventMap extends EventMapBase> = Partial<{
426
+ export type ScreenListeners<in out State extends NavigationState, in out EventMap extends EventMapBase> = Partial<{
412
427
  [EventName in keyof (EventMap & EventMapCore<State>)]: EventListenerCallback<EventMap & EventMapCore<State>, EventName>;
413
428
  }>;
414
429
  type ScreenComponentType<ParamList extends ParamListBase, RouteName extends keyof ParamList> = React.ComponentType<{
@@ -440,13 +455,13 @@ export type RouteConfigComponent<ParamList extends ParamListBase, RouteName exte
440
455
  component?: never;
441
456
  getComponent?: never;
442
457
  };
443
- export type RouteConfigProps<ParamList extends ParamListBase, RouteName extends keyof ParamList, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, Navigation> = {
458
+ export type RouteConfigProps<in out ParamList extends ParamListBase, in out RouteName extends keyof ParamList, in out State extends NavigationState, in out ScreenOptions extends {}, in out EventMap extends EventMapBase, in out Navigation> = {
444
459
  /**
445
460
  * Optional key for this screen. This doesn't need to be unique.
446
461
  * If the key changes, existing screens with this name will be removed or reset.
447
462
  * Useful when we have some common screens and have conditional rendering.
448
463
  */
449
- navigationKey?: string;
464
+ navigationKey?: string | undefined;
450
465
  /**
451
466
  * Route name of this screen.
452
467
  */
@@ -454,58 +469,58 @@ export type RouteConfigProps<ParamList extends ParamListBase, RouteName extends
454
469
  /**
455
470
  * Navigator options for this screen.
456
471
  */
457
- options?: ScreenOptions | ((props: {
472
+ options?: (ScreenOptions | ((props: {
458
473
  route: RouteProp<ParamList, RouteName>;
459
474
  navigation: Navigation;
460
475
  theme: Theme;
461
- }) => ScreenOptions);
476
+ }) => ScreenOptions)) | undefined;
462
477
  /**
463
478
  * Event listeners for this screen.
464
479
  */
465
- listeners?: ScreenListeners<State, EventMap> | ((props: {
480
+ listeners?: (ScreenListeners<State, EventMap> | ((props: {
466
481
  route: RouteProp<ParamList, RouteName>;
467
482
  navigation: Navigation;
468
- }) => ScreenListeners<State, EventMap>);
483
+ }) => ScreenListeners<State, EventMap>)) | undefined;
469
484
  /**
470
485
  * Layout for this screen.
471
486
  * Useful for wrapping the screen with custom containers.
472
487
  * e.g. for styling, error boundaries, suspense, etc.
473
488
  */
474
- layout?: (props: ScreenLayoutArgs<ParamList, RouteName, ScreenOptions, Navigation>) => React.ReactElement;
489
+ layout?: ((props: ScreenLayoutArgs<ParamList, RouteName, ScreenOptions, Navigation>) => React.ReactElement) | undefined;
475
490
  /**
476
491
  * Function to return an unique ID for this screen.
477
492
  * Receives an object with the route params.
478
493
  * For a given screen name, there will always be only one screen corresponding to an ID.
479
494
  * If `undefined` is returned, it acts same as no `getId` being specified.
480
495
  */
481
- getId?: ({ params, }: {
496
+ getId?: (({ params, }: {
482
497
  params: Readonly<ParamList[RouteName]>;
483
- }) => string | undefined;
498
+ }) => string | undefined) | undefined;
484
499
  /**
485
500
  * Initial params object for the route.
486
501
  */
487
- initialParams?: Partial<ParamList[RouteName]>;
502
+ initialParams?: Partial<ParamList[RouteName]> | undefined;
488
503
  };
489
504
  export type RouteConfig<ParamList extends ParamListBase, RouteName extends keyof ParamList, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, Navigation> = RouteConfigProps<ParamList, RouteName, State, ScreenOptions, EventMap, Navigation> & RouteConfigComponent<ParamList, RouteName>;
490
- export type RouteGroupConfig<ParamList extends ParamListBase, ScreenOptions extends {}, Navigation> = {
505
+ export type RouteGroupConfig<in out ParamList extends ParamListBase, in out ScreenOptions extends {}, in out Navigation> = {
491
506
  /**
492
507
  * Optional key for the screens in this group.
493
508
  * If the key changes, all existing screens in this group will be removed or reset.
494
509
  */
495
- navigationKey?: string;
510
+ navigationKey?: string | undefined;
496
511
  /**
497
512
  * Navigator options for this screen.
498
513
  */
499
- screenOptions?: ScreenOptions | ((props: {
500
- route: RouteProp<ParamList, keyof ParamList>;
514
+ screenOptions?: (ScreenOptions | ((props: {
515
+ route: ScreenRouteProp<ParamList>;
501
516
  navigation: Navigation;
502
517
  theme: Theme;
503
- }) => ScreenOptions);
518
+ }) => ScreenOptions)) | undefined;
504
519
  /**
505
520
  * Layout for the screens inside the group.
506
521
  * This will override the `screenLayout` of parent group or navigator.
507
522
  */
508
- screenLayout?: ((props: ScreenLayoutArgs<ParamList, keyof ParamList, ScreenOptions, Navigation>) => React.ReactElement) | {};
523
+ screenLayout?: (((props: ScreenLayoutArgs<ParamList, keyof ParamList, ScreenOptions, Navigation>) => React.ReactElement) | {}) | undefined;
509
524
  /**
510
525
  * Children React Elements to extract the route configuration from.
511
526
  * Only `Screen`, `Group` and `React.Fragment` are supported as children.
@@ -573,15 +588,19 @@ export type NavigationContainerEventMap = {
573
588
  /**
574
589
  * The data object passed when emitting the event.
575
590
  */
576
- data: unknown;
591
+ data?: unknown;
577
592
  /**
578
593
  * The key of the target route which received the event.
579
594
  */
580
- target: string | undefined;
595
+ target?: string | undefined;
581
596
  /**
582
597
  * Whether `event.preventDefault()` was called on this event.
583
598
  */
584
- defaultPrevented: boolean | undefined;
599
+ defaultPrevented?: boolean | undefined;
600
+ /**
601
+ * Prevent the default action which happens on this event.
602
+ */
603
+ preventDefault?: (() => void) | undefined;
585
604
  };
586
605
  };
587
606
  };
@@ -628,46 +647,74 @@ export type GenericNavigation<ParamList extends {}> = Omit<NavigationProp<ParamL
628
647
  */
629
648
  setOptions(options: unknown): void;
630
649
  };
631
- export type RouteForName<ParamList extends {}, RouteName extends string> = Extract<ParamListRoute<ParamList>, {
632
- name: RouteName;
633
- }>;
650
+ export type RouteForName<ParamList extends {}, RouteName extends string> = string extends RouteName ? ParamListRoute<ParamList> : RouteForNameInternal<ParamList, RouteName>;
651
+ type RouteForNameInternal<ParamList extends {}, RouteName extends string> = (RouteName extends KeyOf<ParamList> ? RouteProp<ParamList, RouteName> : never) | RouteForNameNested<NestedParamLists<ParamList>, RouteName>;
652
+ type RouteForNameNested<ParamLists, RouteName extends string> = ParamLists extends {} ? RouteForNameInternal<ParamLists, RouteName> : never;
653
+ /**
654
+ * Union of param lists of the nested navigators in a param list.
655
+ */
656
+ export type NestedParamLists<ParamList extends {}> = {
657
+ [RouteName in keyof ParamList]: NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? ParamListForNavigator<T> : never : never;
658
+ }[keyof ParamList];
634
659
  type ParamListRoute<ParamList extends {}> = {
635
- [RouteName in keyof ParamList]: NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? ParamListRoute<T> | RouteProp<ParamList, RouteName> : RouteProp<ParamList, RouteName> : RouteProp<ParamList, RouteName>;
660
+ [RouteName in keyof ParamList]: NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? ParamListRoute<ParamListForNavigator<T>> | RouteProp<ParamList, RouteName> : RouteProp<ParamList, RouteName> : RouteProp<ParamList, RouteName>;
636
661
  }[keyof ParamList];
637
662
  type MaybeParamListRoute<ParamList extends {}> = ParamList extends ParamListBase ? ParamListRoute<ParamList> : Route<string>;
638
- type BasicNavigationComposite<Navigation extends NavigationProp<any, any, any, any, any>, Parent> = Parent extends NavigationProp<any, any, any, any, any> ? CompositeNavigationProp<Navigation, Parent> : Navigation;
663
+ type BasicNavigationComposite<Navigation extends NavigationProp<any, any, any, any, any>, Parent extends NavigationProp<any, any, any, any, any> | undefined> = Parent extends undefined ? Navigation : CompositeNavigationProp<Navigation, NonNullable<Parent>>;
639
664
  type BasicNavigationList<ParamList extends {}, ExcludedRouteNames, Parent extends NavigationProp<any, any, any, any, any> | undefined> = UnionToIntersection<{
640
- [RouteName in keyof ParamList]: (NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? BasicNavigationList<T, ExcludedRouteNames, NavigationProp<ParamList, RouteName>> : {} : {}) & (RouteName extends ExcludedRouteNames ? {} : {
665
+ [RouteName in keyof ParamList]: (NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? ParamListForNavigator<T> extends infer NestedParamList extends {} ? keyof NestedParamList extends ExcludedRouteNames ? {} : BasicNavigationList<NestedParamList, ExcludedRouteNames, NavigationProp<ParamList, RouteName>> : {} : {} : {}) & (RouteName extends ExcludedRouteNames ? {} : {
641
666
  [Key in RouteName]: BasicNavigationComposite<NavigationProp<ParamList, RouteName>, Parent>;
642
667
  });
643
668
  }[keyof ParamList]>;
644
- export type NavigationListForNavigator<Navigator> = Navigator extends TypedNavigator<infer Bag, any> ? Bag['NavigationList'] : Navigator extends PrivateValueStore<[any, infer NavigationList, any]> ? NavigationList : {};
645
- export type NavigationListForNested<Navigator> = FlatType<NavigationListForNestedInternal<Navigator> & (Navigator extends TypedNavigator<infer Bag, any> ? BasicNavigationList<Bag['ParamList'], keyof NavigationListForNestedInternal<Navigator>, undefined> : Navigator extends PrivateValueStore<[infer ParamList, any, any]> ? ParamList extends {} ? BasicNavigationList<ParamList, keyof NavigationListForNestedInternal<Navigator>, undefined> : {} : {})>;
646
- type NavigationListForNestedInternal<Navigator> = NavigationListForNavigator<Navigator> & NavigationListForStaticConfig<NavigationListForNavigator<Navigator>, Navigator>;
647
- type NavigationListWithComposite<Parent extends NavigationProp<any, any, any, any, any>, NavigatorList extends Record<string, any>> = {
648
- [K in keyof NavigatorList]: CompositeNavigationProp<NavigatorList[K], Parent>;
669
+ type InheritedParentParams<ParentParamList, ParamList> = {
670
+ [K in keyof ParentParamList as K extends keyof ParamList ? never : string extends K ? never : K]: ParentParamList[K];
649
671
  };
650
- type NavigationListForStaticConfig<ParentList, Navigator> = Navigator extends {
672
+ type GenericNavigationComposite<ParamList extends ParamListBase, RouteName extends keyof ParamList, Parent> = Parent extends NavigationProp<any, any, any, any, any> ? ParamListOfNavigationProp<Parent> extends infer ParentParamList ? NavigationProp<ParamList & InheritedParentParams<ParentParamList, ParamList>, RouteName> & {
673
+ getParent: Parent['getParent'];
674
+ } : never : NavigationProp<ParamList, RouteName>;
675
+ type NavigationListForScreenParams<T extends {}, ParamList extends ParamListBase, RouteName extends keyof ParamList, ExcludedRouteNames, Parent extends NavigationProp<any, any, any, any, any> | undefined> = T extends PrivateValueStore<[any, any, any, any]> & NavigatorLike ? NavigationListForNestedInternal<T, GenericNavigationComposite<ParamList, RouteName, Parent>> : NavigationListForParamListScreenParams<T, ParamList, RouteName, ExcludedRouteNames, Parent>;
676
+ type NavigationListForParamListScreenParams<T extends {}, ParamList extends ParamListBase, RouteName extends keyof ParamList, ExcludedRouteNames, Parent extends NavigationProp<any, any, any, any, any> | undefined> = T extends ParamListBase ? BasicNavigationListForParamList<T, ExcludedRouteNames, GenericNavigationComposite<ParamList, RouteName, Parent>> : {};
677
+ type BasicNavigationListForParamList<ParamList extends ParamListBase, ExcludedRouteNames, Parent extends NavigationProp<any, any, any, any, any> | undefined> = UnionToIntersection<{
678
+ [RouteName in keyof ParamList]: (NavigatorScreenParams<{}> extends ParamList[RouteName] ? NotUndefined<ParamList[RouteName]> extends NavigatorScreenParams<infer T> ? NavigationListForScreenParams<T, ParamList, RouteName, ExcludedRouteNames, Parent> : {} : {}) & (RouteName extends ExcludedRouteNames ? {} : {
679
+ [Key in RouteName]: GenericNavigationComposite<ParamList, RouteName, Parent>;
680
+ });
681
+ }[keyof ParamList]>;
682
+ export type NavigationListForNavigator<Navigator> = Navigator extends PrivateValueStore<infer Value> ? Value[1] : {};
683
+ export type NavigationListForNested<Navigator> = NavigationListForNestedInternal<Navigator> extends infer NavigationList ? Navigator extends PrivateValueStore<[infer ParamList, any, any, any]> ? ParamList extends {} ? NavigationList & BasicNavigationList<ParamList, keyof NavigationList, undefined> : NavigationList : NavigationList : never;
684
+ type NavigationListForNestedInternal<Navigator, Parent = undefined, NavigatorList extends Record<string, any> = NavigationListForNavigator<Navigator>, Navigators = NestedNavigatorsOf<Navigator>, ComposedList = ComposeNavigationList<NavigatorList, Parent>> = (Navigator extends {
651
685
  readonly config: {
652
- screens?: any;
653
- groups?: any;
686
+ readonly screens?: infer Screens;
687
+ readonly groups?: infer Groups;
654
688
  };
655
- } ? NavigationListForScreens<ParentList, Navigator['config']['screens']> & NavigationListForGroups<ParentList, Navigator['config']['groups']> : {};
656
- type NavigationListForScreens<ParentList, Screens> = UnionToIntersection<{
657
- [K in keyof Screens]: ParentList extends Record<K, any> ? Screens[K] extends {
689
+ } ? ComposedList & NavigationListForScreens<ComposedList, Screens> & NavigationListForGroups<ComposedList, Groups> : ComposedList) & NavigationListForNestedNavigators<ComposedList, Navigators> & NavigationListForDynamicNestedParamLists<Navigator, ComposedList, Navigators>;
690
+ type NavigationListForDynamicNestedParamLists<Navigator, ParentList, Navigators> = Navigator extends {
691
+ readonly config: unknown;
692
+ } ? {} : Navigator extends PrivateValueStore<[infer ParamList, any, any, any]> ? NavigationListForNestedParamLists<ParentList, ParamList, Navigators> : {};
693
+ type NestedNavigatorsOf<Navigator> = Navigator extends PrivateValueStore<[any, any, any, infer Nesting]> ? Nesting extends Record<string, any> ? Nesting : {} : {};
694
+ type NavigationListForNestedNavigators<ParentList, Navigators> = UnionToIntersection<{
695
+ [K in keyof Navigators]: K extends keyof ParentList ? NavigationListForNestedInternal<Navigators[K], ParentList[K]> : {};
696
+ }[keyof Navigators]>;
697
+ type NavigationListForNestedParamLists<ParentList, ParamList, Navigators> = ParentList extends Record<string, any> ? ParamList extends ParamListBase ? UnionToIntersection<{
698
+ [K in keyof ParamList]: K extends keyof Navigators ? {} : K extends keyof ParentList ? NavigatorScreenParams<{}> extends ParamList[K] ? NotUndefined<ParamList[K]> extends NavigatorScreenParams<infer T> ? NavigationListForScreenParams<T, ParamList, K, keyof ParentList, ParentList[K]> : {} : {} : {};
699
+ }[keyof ParamList]> : {} : {};
700
+ type ComposeNavigationList<NavigatorList extends Record<string, any>, Parent> = Parent extends NavigationProp<any, any, any, any, any> ? {
701
+ [K in keyof NavigatorList]: CompositeNavigationProp<NavigatorList[K], Parent>;
702
+ } : NavigatorList;
703
+ type NavigationListForScreens<ParentList, Screens> = Screens extends {} ? UnionToIntersection<{
704
+ [K in keyof Screens]: Screens[K] extends {
658
705
  config: any;
659
- } ? NavigationListWithComposite<ParentList[K], NavigationListForNested<Screens[K]>> : Screens[K] extends {
706
+ } ? K extends keyof ParentList ? NavigationListForNestedInternal<Screens[K], ParentList[K]> : never : Screens[K] extends {
660
707
  screen: {
661
708
  config: any;
662
709
  };
663
- } ? NavigationListWithComposite<ParentList[K], NavigationListForNested<Screens[K]['screen']>> : {} : {};
664
- }[keyof Screens]>;
665
- type NavigationListForGroups<ParentList, Groups> = Groups extends Record<string, {
666
- screens: any;
667
- }> ? UnionToIntersection<{
668
- [K in keyof Groups]: NavigationListForScreens<ParentList, Groups[K]['screens']>;
710
+ } ? K extends keyof ParentList ? NavigationListForNestedInternal<Screens[K]['screen'], ParentList[K]> : never : never;
711
+ }[keyof Screens]> : {};
712
+ type NavigationListForGroups<ParentList, Groups> = Groups extends {} ? UnionToIntersection<{
713
+ [K in keyof Groups]: Groups[K] extends {
714
+ screens: any;
715
+ } ? NavigationListForScreens<ParentList, Groups[K]['screens']> : never;
669
716
  }[keyof Groups]> : {};
670
- export type NavigationContainerRef<ParamList extends {}> = NavigationHelpers<ParamList> & EventConsumer<NavigationContainerEventMap> & {
717
+ export type NavigationContainerRef<ParamList extends {}> = Omit<NavigationHelpers<ParamList>, keyof NavigationHelpersRoute<{}>> & NavigationHelpersRoute<{}> & EventConsumer<NavigationContainerEventMap> & {
671
718
  /**
672
719
  * Reset the navigation state of the root navigator to the provided state.
673
720
  *
@@ -694,33 +741,61 @@ export type NavigationContainerRef<ParamList extends {}> = NavigationHelpers<Par
694
741
  * Stub function for setOptions on navigation object for use with useNavigation.
695
742
  */
696
743
  setOptions(): never;
697
- /**
698
- * Stub function for getParent on navigation object for use with useNavigation.
699
- */
700
- getParent(): undefined;
701
744
  };
702
745
  export type NavigationContainerRefWithCurrent<ParamList extends {}> = NavigationContainerRef<ParamList> & {
703
746
  current: NavigationContainerRef<ParamList> | null;
704
747
  };
705
- export type NavigationListBase<ParamList extends ParamListBase> = {
748
+ export type NavigationListBase<in out ParamList extends ParamListBase> = {
706
749
  [RouteName in keyof ParamList]: unknown;
707
750
  };
708
- export type NavigatorTypeBagBase = {
751
+ type ActionHelpersOf<T> = T extends Record<string, (...args: any) => void> ? T : {};
752
+ export interface NavigatorTypeBagBase {
709
753
  ParamList: {};
710
754
  State: NavigationState;
711
755
  ScreenOptions: {};
712
756
  EventMap: {};
713
- NavigationList: NavigationListBase<ParamListBase>;
757
+ ActionHelpers: {};
758
+ NavigationList: {
759
+ [RouteName in keyof this['ParamList']]: NavigationProp<this['ParamList'], RouteName, this['State'], this['ScreenOptions'], this['EventMap'], ActionHelpersOf<this['ActionHelpers']>>;
760
+ };
714
761
  Navigator: React.ComponentType<any>;
762
+ }
763
+ /**
764
+ * Adds a proper `ParamList` to a type bag interface
765
+ * So it can be used as `this['ParamList']`
766
+ */
767
+ export type NavigatorTypeBagFor<TypeBag extends NavigatorTypeBagBase, ParamList extends {}> = TypeBag & {
768
+ ParamList: ParamList;
715
769
  };
716
- export type TypedNavigator<Bag extends NavigatorTypeBagBase, Config = unknown> = TypedNavigatorInternal<Bag['ParamList'], Bag['State'], Bag['ScreenOptions'], Bag['EventMap'], Bag['NavigationList'], Bag['Navigator']> & (undefined extends Config ? {} : {
770
+ export type NavigatorProps<ParamList extends ParamListBase, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, Navigation, Navigator extends React.ComponentType<any>> = Omit<React.ComponentProps<Navigator>, keyof DefaultNavigatorOptions<any, any, any, any, any>> & DefaultNavigatorOptions<ParamList, State, ScreenOptions, EventMap, Navigation>;
771
+ type TypedNavigatorStaticComponent<Bag extends NavigatorTypeBagBase> = React.ComponentType<Partial<Omit<NavigatorProps<Bag['ParamList'], Bag['State'], Bag['ScreenOptions'], Bag['EventMap'], Bag['NavigationList'][keyof Bag['ParamList']], Bag['Navigator']>, 'children'>>>;
772
+ type TypedNavigatorStaticDecorated<Bag extends NavigatorTypeBagBase, Config> = {
773
+ getComponent: () => React.ComponentType<{}>;
774
+ config: Config;
775
+ } & PrivateValueStore<[
776
+ Bag['ParamList'],
777
+ Bag['NavigationList'],
778
+ unknown,
779
+ unknown
780
+ ]>;
781
+ type TypedNavigatorStatic<in out Bag extends NavigatorTypeBagBase, in out Config> = {
717
782
  config: Config;
718
- }) & PrivateValueStore<[Bag['ParamList'], Bag['NavigationList'], unknown]>;
719
- type TypedNavigatorInternal<ParamList extends ParamListBase, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, NavigationList extends NavigationListBase<ParamList>, Navigator extends React.ComponentType<any>> = {
783
+ with: (Component: React.ComponentType<{
784
+ Navigator: TypedNavigatorStaticComponent<Bag>;
785
+ }>) => TypedNavigatorStaticDecorated<Bag, Config>;
786
+ getComponent: () => TypedNavigatorStaticComponent<Bag>;
787
+ };
788
+ export type TypedNavigator<Bag extends NavigatorTypeBagBase, Config = unknown, Nesting = unknown> = (undefined extends Config ? TypedNavigatorInternal<Bag['ParamList'], Bag['State'], Bag['ScreenOptions'], Bag['EventMap'], Bag['NavigationList'], Bag['Navigator']> : TypedNavigatorStatic<Bag, Config>) & PrivateValueStore<[
789
+ Bag['ParamList'],
790
+ Bag['NavigationList'],
791
+ unknown,
792
+ Nesting
793
+ ]>;
794
+ type TypedNavigatorInternal<in out ParamList extends ParamListBase, in out State extends NavigationState, in out ScreenOptions extends {}, in out EventMap extends EventMapBase, in out NavigationList extends NavigationListBase<ParamList>, in out Navigator extends React.ComponentType<any>> = {
720
795
  /**
721
796
  * Navigator component which manages the child screens.
722
797
  */
723
- Navigator: React.ComponentType<Omit<React.ComponentProps<Navigator>, keyof DefaultNavigatorOptions<any, any, any, any, any>> & DefaultNavigatorOptions<ParamList, State, ScreenOptions, EventMap, NavigationList[keyof ParamList]>>;
798
+ Navigator: React.ComponentType<NavigatorProps<ParamList, State, ScreenOptions, EventMap, NavigationList[keyof ParamList], Navigator>>;
724
799
  /**
725
800
  * Component used for grouping multiple route configuration.
726
801
  */
@@ -730,35 +805,45 @@ type TypedNavigatorInternal<ParamList extends ParamListBase, State extends Navig
730
805
  */
731
806
  Screen: <RouteName extends keyof ParamList>(_: RouteConfig<ParamList, RouteName, State, ScreenOptions, EventMap, NavigationList[RouteName]>) => null;
732
807
  };
733
- export type NavigatorScreenParams<ParamList extends {}> = {
808
+ declare const NavigatorScreenParamsSymbol: unique symbol;
809
+ type NavigatorScreenParamsBrand<T extends {}> = {
810
+ readonly [NavigatorScreenParamsSymbol]?: any & {
811
+ readonly type: T;
812
+ };
813
+ };
814
+ type NavigatorScreenParamsForParamList<ParamList extends {}> = {
734
815
  screen?: never;
735
816
  params?: never;
736
817
  merge?: never;
737
818
  initial?: never;
738
819
  pop?: never;
739
- path?: string;
820
+ preload?: never;
821
+ path?: string | undefined;
740
822
  state: PartialState<NavigationState> | NavigationState | undefined;
741
823
  } | {
742
824
  [RouteName in keyof ParamList]: undefined extends ParamList[RouteName] ? {
743
825
  screen: RouteName;
744
- params?: ParamList[RouteName];
745
- merge?: boolean;
746
- initial?: boolean;
747
- path?: string;
748
- pop?: boolean;
826
+ params?: ParamList[RouteName] | undefined;
827
+ merge?: boolean | undefined;
828
+ initial?: boolean | undefined;
829
+ path?: string | undefined;
830
+ pop?: boolean | undefined;
831
+ preload?: boolean | undefined;
749
832
  state?: never;
750
833
  } : {
751
834
  screen: RouteName;
752
835
  params: ParamList[RouteName];
753
- merge?: boolean;
754
- initial?: boolean;
755
- path?: string;
756
- pop?: boolean;
836
+ merge?: boolean | undefined;
837
+ initial?: boolean | undefined;
838
+ path?: string | undefined;
839
+ pop?: boolean | undefined;
840
+ preload?: boolean | undefined;
757
841
  state?: never;
758
842
  };
759
843
  }[keyof ParamList];
844
+ export type NavigatorScreenParams<ParamList extends {}> = NavigatorScreenParamsForParamList<ParamListForNavigator<ParamList>> & NavigatorScreenParamsBrand<ParamList>;
760
845
  type ParseConfig<Params> = {
761
- [K in keyof Params]?: (value: string) => Params[K];
846
+ [K in keyof Params]?: ((value: string) => Params[K]) | StandardSchemaV1<string | string[] | null | undefined, Params[K]>;
762
847
  };
763
848
  type StringifyConfig<Params> = {
764
849
  [K in keyof Params]?: (value: Params[K]) => string;
@@ -774,9 +859,9 @@ type PathConfigAlias<Params> = {
774
859
  * By default, paths are relating to the path config on the parent screen.
775
860
  * If `exact` is set to `true`, the parent path configuration is not used.
776
861
  */
777
- exact?: boolean;
862
+ exact?: boolean | undefined;
778
863
  /**
779
- * An object mapping the param name to a function which parses the param value.
864
+ * An object mapping the param name to a parser function or a Standard Schema.
780
865
  *
781
866
  * @example
782
867
  * ```js
@@ -786,12 +871,28 @@ type PathConfigAlias<Params> = {
786
871
  * }
787
872
  * ```
788
873
  */
789
- parse?: ParseConfig<Params>;
874
+ parse?: ParseConfig<Params> | undefined;
875
+ /**
876
+ * Whether this path can resolve to multiple routes.
877
+ * Both routes should specify `shared: true` for this to work.
878
+ * By default, a path can only resolve to one route.
879
+ *
880
+ * This is useful when same screen used in multiple navigators,
881
+ * e.g. tabs with stacks containing profile screen in each stack.
882
+ *
883
+ * The path defined first will be the canonical path.
884
+ */
885
+ shared?: boolean | undefined;
790
886
  };
791
- export type PathConfig<Params> = FlatType<Partial<PathConfigAlias<Params>> & {
887
+ export type PathConfig<Params> = FlatType<Partial<Omit<PathConfigAlias<Params>, 'path'>> & {
888
+ /**
889
+ * Path string to match against.
890
+ * e.g. `/users/:id` will match `/users/1` and extract `id` param as `1`.
891
+ */
892
+ path?: string | undefined;
792
893
  /**
793
894
  * An object mapping the param name to a function which converts the param value to a string.
794
- * By default, all params are converted to strings using `String(value)`.
895
+ * By default, arrays and null are preserved for query params, and other values are converted using `String(value)`.
795
896
  * Keys are constrained to valid param names when Params type is provided.
796
897
  *
797
898
  * @example
@@ -801,23 +902,23 @@ export type PathConfig<Params> = FlatType<Partial<PathConfigAlias<Params>> & {
801
902
  * }
802
903
  * ```
803
904
  */
804
- stringify?: StringifyConfig<Params>;
905
+ stringify?: StringifyConfig<Params> | undefined;
805
906
  /**
806
907
  * Additional path alias that will be matched to the same screen.
807
908
  */
808
- alias?: (string | PathConfigAlias<Params>)[];
809
- } & (NonNullable<Params> extends NavigatorScreenParams<infer ParamList> ? {
909
+ alias?: (string | PathConfigAlias<Params>)[] | undefined;
910
+ } & (NonNullable<Params> extends NavigatorScreenParams<infer ParamList> ? ParamListForNavigator<ParamList> extends infer ChildParamList extends {} ? {
810
911
  /**
811
912
  * Path configuration for child screens.
812
913
  */
813
- screens?: PathConfigMap<ParamList>;
914
+ screens?: PathConfigMap<ChildParamList> | undefined;
814
915
  /**
815
916
  * Name of the initial route to use for the navigator when the path matches.
816
917
  */
817
- initialRouteName?: keyof ParamList;
818
- } : {})>;
918
+ initialRouteName?: Extract<keyof ChildParamList, string> | undefined;
919
+ } : {} : {})>;
819
920
  export type PathConfigMap<ParamList extends {}> = {
820
- [RouteName in keyof ParamList]?: string | PathConfig<ParamList[RouteName]>;
921
+ [RouteName in keyof ParamList]?: string | PathConfig<ParamList[RouteName]> | undefined;
821
922
  };
822
923
  export {};
823
924
  //# sourceMappingURL=types.d.ts.map