Skip to content

Commit

Permalink
fix: allow null in overrides to comply with TS 3.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
phanan committed May 2, 2022
1 parent 4d35771 commit b1c7dc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const isDictionary = (thingy: any) => Object.prototype.toString.call(thingy) ===

let appliedStates: string[] = []

const resolveOverrides = <T> (overrides: Factoria.Overrides<T>): Object => {
const props = Object.assign({}, overrides) as Factoria.Attributes
const resolveOverrides = <T> (overrides: Factoria.Overrides<T>): Record<string, any> => {
const props: Factoria.Attributes = Object.assign({}, overrides)

for (const key in props) {
if (!Object.prototype.hasOwnProperty.call(props, key)) {
Expand Down
2 changes: 1 addition & 1 deletion types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Faker } from '@faker-js/faker'

export declare namespace Factoria {
type Attributes = Record<string, any>
type Overrides<T> = Partial<{ [P in keyof T]: Overrides<T[P]> }> | ((faker: Faker) => any)
type Overrides<T> = Partial<{ [P in keyof T]: Overrides<T[P]> | null }> | ((faker: Faker) => any)
type StateDefinition = ((faker: Faker) => Factoria.Attributes) | Attributes

type Factoria = {
Expand Down

0 comments on commit b1c7dc6

Please sign in to comment.