Skip to content

Commit

Permalink
chore(types): refactor imports and add comments (pmndrs#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Mar 3, 2022
1 parent 027f367 commit 88f4edd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/core/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type WithInitialValue<Value> = {

export type Scope = symbol | string | number

// Not exported for public API
// Are there better typings?
export type SetAtom<
Update,
Expand Down
1 change: 1 addition & 0 deletions src/core/suspensePromise.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const SUSPENSE_PROMISE = Symbol()

// Not exported for public API
export type SuspensePromise = Promise<void> & {
[SUSPENSE_PROMISE]: {
o: Promise<void> // original promise
Expand Down
6 changes: 3 additions & 3 deletions src/core/useSetAtom.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useContext } from 'react'
import type { Scope, SetAtom, WritableAtom } from '../core/atom'
import { WRITE_ATOM } from '../core/store'
import type { VersionObject } from '../core/store'
import type { Scope, SetAtom, WritableAtom } from './atom'
import { getScopeContext } from './contexts'
import { WRITE_ATOM } from './store'
import type { VersionObject } from './store'

export function useSetAtom<Value, Update, Result extends void | Promise<void>>(
atom: WritableAtom<Value, Update, Result>,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/weakCache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Atom } from 'jotai'

export type WeakCache<T> = WeakMap<object, [WeakCache<T>] | [WeakCache<T>, T]>
type WeakCache<T> = WeakMap<object, [WeakCache<T>] | [WeakCache<T>, T]>

const getWeakCacheItem = <T>(
cache: WeakCache<T>,
Expand Down

0 comments on commit 88f4edd

Please sign in to comment.