@@ -81,9 +81,6 @@ export const RESERVED = [
81
81
export const CHECKPOINT_NAMESPACE_SEPARATOR = "|" ;
82
82
export const CHECKPOINT_NAMESPACE_END = ":" ;
83
83
84
- // eslint-disable-next-line @typescript-eslint/ban-types
85
- type AnyString = string & { } ;
86
-
87
84
// eslint-disable-next-line @typescript-eslint/no-explicit-any
88
85
export interface SendInterface < Node extends string = string , Args = any > {
89
86
node : Node ;
@@ -182,8 +179,8 @@ export type Interrupt = {
182
179
183
180
export type CommandParams <
184
181
Resume = unknown ,
185
- Nodes extends string = string ,
186
- Update = unknown
182
+ Update extends Record < string , unknown > = Record < string , unknown > ,
183
+ Nodes extends string = string
187
184
> = {
188
185
/**
189
186
* A discriminator field used to identify the type of object. Must be populated when serializing.
@@ -208,7 +205,7 @@ export type CommandParams<
208
205
/**
209
206
* Update to apply to the graph's state.
210
207
*/
211
- update ?: Record < string , unknown > | [ string , unknown ] [ ] ;
208
+ update ?: Update | [ string , unknown ] [ ] ;
212
209
213
210
/**
214
211
* Can be one of the following:
@@ -219,8 +216,8 @@ export type CommandParams<
219
216
*/
220
217
goto ?:
221
218
| Nodes
222
- | SendInterface < Nodes , Update >
223
- | ( Nodes | SendInterface < Nodes , Update > ) [ ] ;
219
+ | SendInterface < Nodes > // eslint-disable-line @typescript-eslint/no-explicit-any
220
+ | ( Nodes | SendInterface < Nodes > ) [ ] ; // eslint-disable-line @typescript-eslint/no-explicit-any
224
221
} ;
225
222
226
223
/**
@@ -287,8 +284,8 @@ export type CommandParams<
287
284
*/
288
285
export class Command <
289
286
Resume = unknown ,
290
- Nodes extends string = string ,
291
- Update = unknown
287
+ Update extends Record < string , unknown > = Record < string , unknown > ,
288
+ Nodes extends string = string
292
289
> {
293
290
readonly lg_name = "Command" ;
294
291
@@ -306,7 +303,7 @@ export class Command<
306
303
* Update to apply to the graph's state as a result of executing the node that is returning the command.
307
304
* Written to the state as if the node had simply returned this value instead of the Command object.
308
305
*/
309
- update ?: Record < string , unknown > | [ string , unknown ] [ ] ;
306
+ update ?: Update | [ string , unknown ] [ ] ;
310
307
311
308
/**
312
309
* Value to resume execution with. To be used together with {@link interrupt}.
@@ -320,11 +317,11 @@ export class Command<
320
317
* - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
321
318
* - sequence of {@link Send} objects
322
319
*/
323
- goto ?: Nodes | Send < Nodes , Update > | ( Nodes | Send < Nodes , Update > ) [ ] = [ ] ;
320
+ goto ?: Nodes | Send < Nodes > | ( Nodes | Send < Nodes > ) [ ] = [ ] ;
324
321
325
322
static PARENT = "__parent__" ;
326
323
327
- constructor ( args : CommandParams < Resume , Nodes | AnyString , Update > ) {
324
+ constructor ( args : CommandParams < Resume , Update , Nodes > ) {
328
325
this . resume = args . resume ;
329
326
this . graph = args . graph ;
330
327
this . update = args . update ;
0 commit comments