Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
pasyukevich committed Oct 30, 2023
1 parent 43adb91 commit b671742
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/components/ErrorBoundary/BaseErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import {ErrorBoundary} from 'react-error-boundary';
import BootSplash from '@libs/BootSplash';
import GenericErrorPage from '@pages/ErrorPage/GenericErrorPage';

type LogError = (message: string, error: Error, errorInfo: string) => void;
import LogError from './types';

type BaseErrorBoundaryProps = {
/* A message posted to `logError` (along with error data) when this component intercepts an error */
Expand Down
6 changes: 3 additions & 3 deletions src/components/ErrorBoundary/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import crashlytics from '@react-native-firebase/crashlytics';

import BaseErrorBoundary, {LogError, BaseErrorBoundaryProps} from './BaseErrorBoundary';
import Log from '@libs/Log';
import BaseErrorBoundary, {BaseErrorBoundaryProps} from './BaseErrorBoundary';
import LogError from './types';

const logError: LogError = (errorMessage, error, errorInfo) => {
// Log the error to the server
Expand All @@ -13,7 +13,7 @@ const logError: LogError = (errorMessage, error, errorInfo) => {
crashlytics().recordError(error);
};

function ErrorBoundary({errorMessage, children}: BaseErrorBoundaryProps) {
function ErrorBoundary({errorMessage, children}: Omit<BaseErrorBoundaryProps, 'logError'>) {
return (
<BaseErrorBoundary
errorMessage={errorMessage}
Expand Down
5 changes: 3 additions & 2 deletions src/components/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import BaseErrorBoundary, {LogError, BaseErrorBoundaryProps} from './BaseErrorBoundary';
import Log from '@libs//Log';
import BaseErrorBoundary, {BaseErrorBoundaryProps} from './BaseErrorBoundary';
import LogError from './types';

const logError: LogError = (errorMessage, error, errorInfo) => {
// Log the error to the server
Log.alert(`${errorMessage} - ${error.message}`, {errorInfo}, false);
};

function ErrorBoundary({errorMessage, children}: BaseErrorBoundaryProps) {
function ErrorBoundary({errorMessage, children}: Omit<BaseErrorBoundaryProps, 'logError'>) {
return (
<BaseErrorBoundary
errorMessage={errorMessage}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ErrorBoundary/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type LogError = (message: string, error: Error, errorInfo: string) => void;

export default LogError;

0 comments on commit b671742

Please sign in to comment.