Skip to content

Commit

Permalink
test(ts): parameter types of curried producers
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Jan 11, 2019
1 parent 31bbe64 commit f820657
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions __tests__/produce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import produce, {
produce as produce2,
applyPatches,
Patch,
DraftArray,
Draft,
nothing
} from "../dist/immer.js"

Expand Down Expand Up @@ -140,11 +138,15 @@ it("can apply patches", () => {
})

it("can provide rest parameters to a curried producer", () => {
let foo = produce((_1: {}, _2: number, _3: number) => {})
type Foo = (base: object, _2: number, _3: number) => object
let foo = produce((_1: object, _2: number, _3: number) => {})
exactType(foo, {} as Foo)
foo({}, 1, 2)

// With initial state:
let bar = produce((_1: {}, _2: number, _3: number) => {}, {})
type Bar = (base: object | undefined, _2: number, _3: number) => object
let bar = produce((_1: object, _2: number, _3: number) => {}, {})
exactType(bar, {} as Bar)
bar(undefined, 1, 2)
})

Expand Down

0 comments on commit f820657

Please sign in to comment.