From adbe0957ecc5c4a04ed641ba24e49d63b62849a2 Mon Sep 17 00:00:00 2001 From: DanThemes Date: Tue, 1 Oct 2024 10:54:17 +0300 Subject: [PATCH] Update typescript.md Typo: "That is to say how could **do** we type ..." --- docs/guides/typescript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/typescript.md b/docs/guides/typescript.md index 647c533d62..ce58663273 100644 --- a/docs/guides/typescript.md +++ b/docs/guides/typescript.md @@ -226,7 +226,7 @@ const useBearStore = create(foo(() => ({ bears: 0 }), 'hello')) console.log(useBearStore.foo.toUpperCase()) ``` -Zustand middlewares can mutate the store. But how could we possibly encode the mutation on the type-level? That is to say how could do we type `foo` so that this code compiles? +Zustand middlewares can mutate the store. But how could we possibly encode the mutation on the type-level? That is to say how could we type `foo` so that this code compiles? For a usual statically typed language, this is impossible. But thanks to TypeScript, Zustand has something called a "higher-kinded mutator" that makes this possible. If you are dealing with complex type problems, like typing a middleware or using the `StateCreator` type, you will have to understand this implementation detail. For this, you can [check out #710](https://github.com/pmndrs/zustand/issues/710).