Skip to content

Commit

Permalink
IReportingOptions -> ReportingOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Nov 3, 2022
1 parent 4644fc3 commit b611741
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions packages/workflow/src/ErrorReporterProxy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export interface IReportingOptions {
tags?: Record<string, string>;
import type { Primitives } from './utils';

export interface ReportingOptions {
tags?: Record<string, Primitives>;
extra?: Record<string, unknown>;
}

interface ErrorReporter {
error: (error: Error, options?: IReportingOptions) => void;
warn: (warning: Error | string, options?: IReportingOptions) => void;
error: (error: Error, options?: ReportingOptions) => void;
warn: (warning: Error | string, options?: ReportingOptions) => void;
}

const isProduction = process.env.NODE_ENV === 'production';
Expand All @@ -20,9 +22,9 @@ export function init(errorReporter: ErrorReporter) {
instance.warn = errorReporter.warn;
}

export const error = (e: unknown, options?: IReportingOptions) => {
export const error = (e: unknown, options?: ReportingOptions) => {
if (e instanceof Error) instance.error(e, options);
};

export const warn = (warning: Error | string, options?: IReportingOptions) =>
export const warn = (warning: Error | string, options?: ReportingOptions) =>
instance.warn(warning, options);
3 changes: 2 additions & 1 deletion packages/workflow/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as ErrorReporter from './ErrorReporterProxy';

export type Primitives = string | number | boolean | bigint | symbol | null | undefined;

/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */
type Primitives = string | number | boolean | bigint | symbol | null | undefined;
export const deepCopy = <T extends ((object | Date) & { toJSON?: () => string }) | Primitives>(
source: T,
hash = new WeakMap(),
Expand Down

0 comments on commit b611741

Please sign in to comment.