Skip to content

Commit

Permalink
Replace object type defs with dictionary type (#1079)
Browse files Browse the repository at this point in the history
* replace `object` type defs with dictionary type

* prefer unknown over any
  • Loading branch information
waltjones authored Jan 3, 2023
1 parent ee796c3 commit d7e9cbe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,22 @@ declare namespace Rollbar {
) => void | Promise<TResult>;
export type MaybeError = Error | undefined | null;
export type Level = "debug" | "info" | "warning" | "error" | "critical";
export type Dictionary = { [key: string]: unknown};
/**
* {@link https://docs.rollbar.com/docs/rollbarjs-configuration-reference#reference}
*/
export interface Configuration {
accessToken?: string;
addErrorContext?: boolean;
addRequestData?: (data: object, req: object) => void;
addRequestData?: (data: Dictionary, req: Dictionary) => void;
autoInstrument?: AutoInstrumentOptions;
captureEmail?: boolean;
captureIp?: boolean | "anonymize";
captureLambdaTimeouts?: boolean;
captureUncaught?: boolean;
captureUnhandledRejections?: boolean;
captureUsername?: boolean;
checkIgnore?: (isUncaught: boolean, args: LogArgument[], item: object) => boolean;
checkIgnore?: (isUncaught: boolean, args: LogArgument[], item: Dictionary) => boolean;
/**
* `codeVersion` takes precedence over `code_version`, if provided.
* `client.javascript.code_version` takes precedence over both top level properties.
Expand Down Expand Up @@ -86,7 +87,7 @@ declare namespace Rollbar {
maxRetries?: number;
maxTelemetryEvents?: number;
nodeSourceMaps?: boolean;
onSendCallback?: (isUncaught: boolean, args: LogArgument[], item: object) => void;
onSendCallback?: (isUncaught: boolean, args: LogArgument[], item: Dictionary) => void;
overwriteScrubFields?: boolean;
payload?: Payload;
reportLevel?: Level;
Expand All @@ -101,23 +102,23 @@ declare namespace Rollbar {
stackTraceLimit?: number;
telemetryScrubber?: TelemetryScrubber;
timeout?: number;
transform?: (data: object, item: object) => void | Promise<void>;
transform?: (data: Dictionary, item: Dictionary) => void | Promise<void>;
transmit?: boolean;
uncaughtErrorLevel?: Level;
verbose?: boolean;
version?: string;
wrapGlobalEventHandlers?: boolean;
}
export type Callback<TResponse = any> = (err: MaybeError, response: TResponse) => void;
export type LogArgument = string | Error | object | Callback | Date | any[] | undefined;
export type LogArgument = string | Error | object | Dictionary | Callback | Date | any[] | undefined;
export interface LogResult {
uuid: string;
}
export interface TelemetryEvent {
level: Level;
type: string;
timestamp_ms: number;
body: object;
body: Dictionary;
source: string;
uuid?: string;
}
Expand Down

0 comments on commit d7e9cbe

Please sign in to comment.