mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
refactor(types): prefer using import type (#1208)
This commit is contained in:
parent
e1e83e3160
commit
0f4913c7ec
@ -1,12 +1,13 @@
|
||||
import {
|
||||
ReactNode,
|
||||
createElement,
|
||||
createContext as reactCreateContext,
|
||||
useContext,
|
||||
useMemo,
|
||||
useRef,
|
||||
} from 'react'
|
||||
import { StoreApi, useStore } from 'zustand'
|
||||
import type { ReactNode } from 'react'
|
||||
import { useStore } from 'zustand'
|
||||
import type { StoreApi } from 'zustand'
|
||||
|
||||
type UseContextStore<S extends StoreApi<unknown>> = {
|
||||
(): ExtractState<S>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
|
||||
type Write<T, U> = Omit<T, keyof U> & U
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type {} from '@redux-devtools/extension'
|
||||
import { StateCreator, StoreApi, StoreMutatorIdentifier } from '../vanilla'
|
||||
import type { StateCreator, StoreApi, StoreMutatorIdentifier } from '../vanilla'
|
||||
|
||||
// Copy types to avoid import type { Config } from '@redux-devtools/extension'
|
||||
// https://github.com/pmndrs/zustand/issues/1205
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line import/named
|
||||
import { Draft, produce } from 'immer'
|
||||
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
import { produce } from 'immer'
|
||||
import type { Draft } from 'immer'
|
||||
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
|
||||
type Immer = <
|
||||
T,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { StateCreator, StoreApi, StoreMutatorIdentifier } from '../vanilla'
|
||||
import type { StateCreator, StoreApi, StoreMutatorIdentifier } from '../vanilla'
|
||||
|
||||
export interface StateStorage {
|
||||
getItem: (name: string) => string | null | Promise<string | null>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
import { NamedSet } from './devtools'
|
||||
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
import type { NamedSet } from './devtools'
|
||||
|
||||
type Write<T, U> = Omit<T, keyof U> & U
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
|
||||
|
||||
type SubscribeWithSelector = <
|
||||
T,
|
||||
|
||||
@ -4,7 +4,8 @@ import { useDebugValue } from 'react'
|
||||
// See: https://github.com/pmndrs/valtio/issues/452
|
||||
// The following is a workaround until ESM is supported.
|
||||
import useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector'
|
||||
import createStore, {
|
||||
import createStore from './vanilla'
|
||||
import type {
|
||||
Mutate,
|
||||
StateCreator,
|
||||
StoreApi,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user