refactor(types): prefer using import type (#1208)

This commit is contained in:
Daishi Kato 2022-08-22 11:25:01 +09:00 committed by GitHub
parent e1e83e3160
commit 0f4913c7ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 12 deletions

View File

@ -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>

View File

@ -1,4 +1,4 @@
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
type Write<T, U> = Omit<T, keyof U> & U

View File

@ -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

View File

@ -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,

View File

@ -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>

View File

@ -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

View File

@ -1,4 +1,4 @@
import { StateCreator, StoreMutatorIdentifier } from '../vanilla'
import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'
type SubscribeWithSelector = <
T,

View File

@ -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,