This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-21
lines changed Expand file tree Collapse file tree 2 files changed +29
-21
lines changed Original file line number Diff line number Diff line change 1
1
import type { DebugConfig , FullDB } from "../../../core" ;
2
2
import type { ReactType } from "../types" ;
3
+ import type {
4
+ Changer ,
5
+ MassUpdater ,
6
+ MassUpdaterInternal ,
7
+ Updater ,
8
+ UpdaterInternal ,
9
+ } from "./types" ;
10
+
11
+ export type { MassUpdater , Updater } from "./types" ;
3
12
4
13
function flat < T > ( list : T [ ] [ ] ) : T [ ] {
5
14
return list . reduce ( ( a , b ) => a . concat ( b ) ) ;
6
15
}
7
16
8
- type MassUpdaterInternal < Domain , K extends keyof Domain > = (
9
- options : { } ,
10
- kind : K ,
11
- id : string ,
12
- delta : ( prev : Domain [ K ] ) => Domain [ K ]
13
- ) => void ;
14
- export type MassUpdater < Domain , K extends keyof Domain > = MassUpdaterInternal <
15
- Domain ,
16
- K
17
- > & {
18
- ( kind : K , id : string , delta : ( prev : Domain [ K ] ) => Domain [ K ] ) : void ;
19
- } ;
20
-
21
- type UpdaterInternal < T > = ( options : { } , delta : ( prev : T ) => T ) => void ;
22
- export type Updater < T > = UpdaterInternal < T > & {
23
- ( delta : ( prev : T ) => T ) : void ;
24
- } & ( T extends { }
25
- ? { < K extends keyof T & string > ( field : K , value : T [ K ] ) : void }
26
- : { } ) ;
27
- type Changer < T > = [ T | "loading" , Updater < T > ] ;
28
-
29
17
function makeMassUpdater < Domain , K extends keyof Domain > (
30
18
db : FullDB < Domain >
31
19
) : MassUpdater < Domain , K > {
Original file line number Diff line number Diff line change
1
+ export type MassUpdaterInternal < Domain , K extends keyof Domain > = (
2
+ options : { } ,
3
+ kind : K ,
4
+ id : string ,
5
+ delta : ( prev : Domain [ K ] ) => Domain [ K ]
6
+ ) => void ;
7
+ export type MassUpdater < Domain , K extends keyof Domain > = MassUpdaterInternal <
8
+ Domain ,
9
+ K
10
+ > & {
11
+ ( kind : K , id : string , delta : ( prev : Domain [ K ] ) => Domain [ K ] ) : void ;
12
+ } ;
13
+
14
+ export type UpdaterInternal < T > = ( options : { } , delta : ( prev : T ) => T ) => void ;
15
+ export type Updater < T > = UpdaterInternal < T > & {
16
+ ( delta : ( prev : T ) => T ) : void ;
17
+ } & ( T extends { }
18
+ ? { < K extends keyof T & string > ( field : K , value : T [ K ] ) : void }
19
+ : { } ) ;
20
+ export type Changer < T > = [ T | "loading" , Updater < T > ] ;
You can’t perform that action at this time.
0 commit comments