Skip to content

Commit

Permalink
Fixed defaultOptions typing
Browse files Browse the repository at this point in the history
Signed-off-by: Slava Fomin <slava@fomin.io>
  • Loading branch information
slavafomin committed Nov 24, 2024
1 parent 2462125 commit fedf4c3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/typesAndDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ export interface OptionsInterface<C extends Context, RT extends RedisType> {
keyPrefix?: string | undefined;
}

export const defaultOptions: OptionsInterface<Context, RedisType> = {
type DefaultOptions = Required<Pick<
OptionsInterface<Context, RedisType>, (
| 'timeFrame'
| 'limit'
| 'onLimitExceeded'
| 'storageClient'
| 'keyGenerator'
| 'keyPrefix'
)>
>;

export const defaultOptions: DefaultOptions = {
timeFrame: 1000,
limit: 1,
onLimitExceeded: (_ctx: Context, _next: NextFunction) => {},
Expand Down

0 comments on commit fedf4c3

Please sign in to comment.