Skip to content

Commit a8d78af

Browse files
authored
chore: fix some comments (#1122)
Signed-off-by: clonemycode <clonecode@aliyun.com>
1 parent 062210e commit a8d78af

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

__tests__/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function runBaseTest(name, autoFreeze, useStrictShallowCopy, useListener) {
490490
expect(nextState.get(key)).toEqual(true)
491491
})
492492

493-
it("state stays the same if the the same item is assigned by key", () => {
493+
it("state stays the same if the same item is assigned by key", () => {
494494
const nextState = produce(baseState, s => {
495495
s.aMap.set("jediTotal", 42)
496496
})

__tests__/produce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ it("infers curried", () => {
736736
assert(n, _ as State)
737737
}
738738
{
739-
// explictly use generic
739+
// explicitly use generic
740740
const f = produce<ROState>(draft => {
741741
draft.count++
742742
})

website/docs/typescript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Note that we did wrap the `Todo` type of the `draft` argument with `Draft`, beca
109109

110110
For the returned curried function, `toggler`, We will _narrow_ the _input_ type to `Immutable<Todo>`, so that even though `Todo` is a mutable type, we will still accept an immutable todo as input argument to `toggler`.
111111

112-
In contrast, Immer will _widen_ the _output_ type of the curried function to `Writable<Todo>`, to make sure it's output state is also assignable to variables that are not explictly typed to be immutable.
112+
In contrast, Immer will _widen_ the _output_ type of the curried function to `Writable<Todo>`, to make sure it's output state is also assignable to variables that are not explicitly typed to be immutable.
113113

114114
This type narrowing / widening behavior might be unwelcome, maybe even for the simple reason that it results in quite noisy types. So we recommend to specify the generic state type for curried producers instead, in cases where it cannot be inferred directly, like `toggler` above. By doing so the automatic output widening / input narrowing will be skipped. However, the `draft` argument itself will still be inferred to be a writable `Draft<Todo>`:
115115

0 commit comments

Comments
 (0)