Skip to content

Commit

Permalink
Adjust how type is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Sep 12, 2023
1 parent cd5730b commit b023871
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/libs/Metrics/index.native.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import CONFIG from '../../CONFIG';
import Metrics from './types';
import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types';

/**
* Is capturing performance stats enabled.
*/
const canCapturePerformanceMetrics: Metrics['canCapturePerformanceMetrics'] = () => CONFIG.CAPTURE_METRICS;
const canCapturePerformanceMetrics: CanCapturePerformanceMetrics = () => CONFIG.CAPTURE_METRICS;

/**
* Is capturing Onyx stats enabled.
*/
const canCaptureOnyxMetrics: Metrics['canCaptureOnyxMetrics'] = () => CONFIG.ONYX_METRICS;
const canCaptureOnyxMetrics: CanCaptureOnyxMetrics = () => CONFIG.ONYX_METRICS;

export {canCapturePerformanceMetrics, canCaptureOnyxMetrics};
6 changes: 3 additions & 3 deletions src/libs/Metrics/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import CONFIG from '../../CONFIG';
import Metrics from './types';
import {CanCaptureOnyxMetrics, CanCapturePerformanceMetrics} from './types';

// We don't capture performance metrics on web as there are enough tools available
const canCapturePerformanceMetrics: Metrics['canCapturePerformanceMetrics'] = () => false;
const canCapturePerformanceMetrics: CanCapturePerformanceMetrics = () => false;

const canCaptureOnyxMetrics: Metrics['canCaptureOnyxMetrics'] = () => CONFIG.ONYX_METRICS;
const canCaptureOnyxMetrics: CanCaptureOnyxMetrics = () => CONFIG.ONYX_METRICS;

export {canCapturePerformanceMetrics, canCaptureOnyxMetrics};
8 changes: 3 additions & 5 deletions src/libs/Metrics/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
type Metrics = {
canCapturePerformanceMetrics: () => boolean;
canCaptureOnyxMetrics: () => boolean;
};
type CanCapturePerformanceMetrics = () => boolean;
type CanCaptureOnyxMetrics = () => boolean;

export default Metrics;
export type {CanCapturePerformanceMetrics, CanCaptureOnyxMetrics};

0 comments on commit b023871

Please sign in to comment.