fix(docs): Fix 'State' declaration position (#1438)

* Fix 'State' declaration position

* Update auto-generating-selectors.md

Update pr with review

* Update auto-generating-selectors.md
This commit is contained in:
hicucu 2022-12-05 12:02:52 +09:00 committed by GitHub
parent bf9d0922fe
commit 47b2b64e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,13 +14,13 @@ However, writing these could be tedious. If that is the case for you, you can au
## create the following function: `createSelectors`
```typescript
import { State, StoreApi, UseBoundStore } from 'zustand'
import { StoreApi, UseBoundStore } from 'zustand'
type WithSelectors<S> = S extends { getState: () => infer T }
? S & { use: { [K in keyof T]: () => T[K] } }
: never
const createSelectors = <S extends UseBoundStore<StoreApi<State>>>(
const createSelectors = <S extends UseBoundStore<StoreApi<object>>>(
_store: S
) => {
let store = _store as WithSelectors<typeof _store>