Skip to content

Commit

Permalink
fix(settings): make it clear that settings are optional and defaults …
Browse files Browse the repository at this point in the history
…exist for all things
  • Loading branch information
djMax committed Jun 15, 2024
1 parent d03b7f5 commit 9e2d561
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ export type ExecutionResult = {
*
*/
export interface Settings {
readonly driftFactor: number;
readonly retryCount: number;
readonly retryDelay: number;
readonly retryJitter: number;
readonly automaticExtensionThreshold: number;
readonly db: number;
readonly driftFactor?: number;
readonly retryCount?: number;
readonly retryDelay?: number;
readonly retryJitter?: number;
readonly automaticExtensionThreshold?: number;
readonly db?: number;
}

// Define default settings.
const defaultSettings: Readonly<Settings> = {
const defaultSettings: Readonly<Required<Settings>> = {
driftFactor: 0.01,
retryCount: 10,
retryDelay: 200,
Expand Down Expand Up @@ -128,9 +128,9 @@ export interface RedlockUsingContext {
*/
export class Redlock extends EventEmitter {
public readonly clients: Set<Client>;
public readonly settings: Settings;
public readonly settings: Required<Settings>;

public constructor(clients: Iterable<Client>, settings: Partial<Settings> = {}) {
public constructor(clients: Iterable<Client>, settings: Settings = {}) {
super();

// Prevent crashes on error events.
Expand Down

0 comments on commit 9e2d561

Please sign in to comment.