Skip to content

Commit

Permalink
Simplify types
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Oct 2, 2023
1 parent 555a8a0 commit 42ac076
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sync-map-template/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ export function ensureLoaded<Value extends SyncMapValues>(
value: FilterValue<Value>
): LoadedFilterValue<Value>

export type LoadedValue<Type extends { isLoading: boolean }> = Type & {
isLoading: false
}

type LoadableStore = ReadableStore<{ isLoading: boolean }> & {
readonly loading: Promise<void>
}
Expand All @@ -296,12 +300,6 @@ type LoadableStore = ReadableStore<{ isLoading: boolean }> & {
*
* @param store Store to load.
*/
export function loadValue<Value extends SyncMapValues>(
store: SyncMapStore<Value>
): Promise<LoadedSyncMapValue<Value>>
export function loadValue<Value extends SyncMapValues>(
store: FilterStore<Value>
): Promise<LoadedFilterValue<Value>>
export function loadValue<Store extends LoadableStore>(
store: Store
): Promise<StoreValue<Store>>
): Promise<LoadedValue<StoreValue<Store>>>

0 comments on commit 42ac076

Please sign in to comment.