Skip to content

Commit

Permalink
Update types for TS 4.7 (#163)
Browse files Browse the repository at this point in the history
`Conf` requires `T` have a constraint of `Record<string, any>`. In previous versions of TS, this error went undetected.
  • Loading branch information
weswigham authored Mar 30, 2022
1 parent 07f5344 commit eb1da20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {JSONSchema as TypedJSONSchema} from 'json-schema-typed';
import Conf from '.';
import {EventEmitter} from 'events';

export interface Options<T> {
export interface Options<T extends Record<string, any>> {
/**
Config used if there are no existing config.
Expand Down Expand Up @@ -225,7 +225,7 @@ export interface Options<T> {
readonly configFileMode?: number;
}

export type Migrations<T> = Record<string, (store: Conf<T>) => void>;
export type Migrations<T extends Record<string, any>> = Record<string, (store: Conf<T>) => void>;

export type Schema<T> = {[Property in keyof T]: ValueSchema};
export type ValueSchema = TypedJSONSchema;
Expand Down

0 comments on commit eb1da20

Please sign in to comment.