Skip to content

Commit

Permalink
ref(ui): Add return types to useNavigate, useRouter (#76739)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored Aug 29, 2024
1 parent 1448adb commit 9d79685
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion static/app/utils/useNavigate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface ReactRouter3Navigate {
*
* @see https://reactrouter.com/hooks/use-navigate
*/
export function useNavigate() {
export function useNavigate(): ReactRouter3Navigate {
// When running in test mode we still read from the legacy route context to
// keep test compatability while we fully migrate to react router 6
const useReactRouter6 = window.__SENTRY_USING_REACT_ROUTER_SIX && NODE_ENV !== 'test';
Expand Down
2 changes: 1 addition & 1 deletion static/app/utils/useRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {useRoutes} from './useRoutes';
*
* react-router 6 does not include this hook.
*/
function useRouter() {
function useRouter(): InjectedRouter<any, any> {
// When running in test mode we still read from the legacy route context to
// keep test compatability while we fully migrate to react router 6
const useReactRouter6 = window.__SENTRY_USING_REACT_ROUTER_SIX && NODE_ENV !== 'test';
Expand Down
2 changes: 1 addition & 1 deletion static/app/utils/useRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {useMatches} from 'react-router-dom';
import {NODE_ENV} from 'sentry/constants';
import {useRouteContext} from 'sentry/utils/useRouteContext';

export function useRoutes() {
export function useRoutes(): PlainRoute<any>[] {
// When running in test mode we still read from the legacy route context to
// keep test compatability while we fully migrate to react router 6
const useReactRouter6 = window.__SENTRY_USING_REACT_ROUTER_SIX && NODE_ENV !== 'test';
Expand Down

0 comments on commit 9d79685

Please sign in to comment.