-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Viktor Pasynok
committed
Nov 3, 2024
1 parent
8e6d984
commit c9b6f30
Showing
4 changed files
with
83 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { type Store } from 'effector'; | ||
import { type StoreWritable } from 'effector'; | ||
|
||
type NonEmptyTuple<T = unknown> = [T, ...T[]]; | ||
type AnyObject = Record<string, unknown>; | ||
|
||
type Status = 'idle' | 'pending' | 'done' | 'fail' | 'off'; | ||
type AnyAPI = AnyObject | null; | ||
type StartResult<T> = Promise<{ api: T }> | { api: T }; | ||
type AnyStartFn = (...x: any) => StartResult<any>; | ||
type AnyStartFn = (...x: any) => StartResult<AnyAPI>; | ||
type EnableResult = Promise<boolean> | boolean; | ||
|
||
type Container<Id extends string, StartFn extends AnyStartFn> = { | ||
id: Id; | ||
$status: Store<Status>; | ||
start: StartFn; | ||
type AnyContainer = { | ||
id: string; | ||
$status: StoreWritable<Status>; | ||
start: AnyStartFn; | ||
dependsOn?: AnyContainer[]; | ||
optionalDependsOn?: AnyContainer[]; | ||
enable?: (..._: any) => EnableResult; | ||
}; | ||
type AnyContainer = Container<string, AnyStartFn>; | ||
|
||
type AnyDeps = NonEmptyTuple<AnyContainer> | void; | ||
|
||
export type { AnyAPI, AnyContainer, AnyDeps, AnyStartFn, Container, EnableResult, StartResult, Status }; | ||
export type { AnyAPI, AnyContainer, AnyDeps, AnyStartFn, EnableResult, StartResult, Status }; |