Skip to content

Commit 2763e52

Browse files
committed
Reorder
1 parent e666415 commit 2763e52

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

libs/langgraph/src/constants.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ export const RESERVED = [
8181
export const CHECKPOINT_NAMESPACE_SEPARATOR = "|";
8282
export const CHECKPOINT_NAMESPACE_END = ":";
8383

84-
// eslint-disable-next-line @typescript-eslint/ban-types
85-
type AnyString = string & {};
86-
8784
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8885
export interface SendInterface<Node extends string = string, Args = any> {
8986
node: Node;
@@ -182,8 +179,8 @@ export type Interrupt = {
182179

183180
export type CommandParams<
184181
Resume = unknown,
185-
Nodes extends string = string,
186-
Update = unknown
182+
Update extends Record<string, unknown> = Record<string, unknown>,
183+
Nodes extends string = string
187184
> = {
188185
/**
189186
* A discriminator field used to identify the type of object. Must be populated when serializing.
@@ -208,7 +205,7 @@ export type CommandParams<
208205
/**
209206
* Update to apply to the graph's state.
210207
*/
211-
update?: Record<string, unknown> | [string, unknown][];
208+
update?: Update | [string, unknown][];
212209

213210
/**
214211
* Can be one of the following:
@@ -219,8 +216,8 @@ export type CommandParams<
219216
*/
220217
goto?:
221218
| 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
224221
};
225222

226223
/**
@@ -287,8 +284,8 @@ export type CommandParams<
287284
*/
288285
export class Command<
289286
Resume = unknown,
290-
Nodes extends string = string,
291-
Update = unknown
287+
Update extends Record<string, unknown> = Record<string, unknown>,
288+
Nodes extends string = string
292289
> {
293290
readonly lg_name = "Command";
294291

@@ -306,7 +303,7 @@ export class Command<
306303
* Update to apply to the graph's state as a result of executing the node that is returning the command.
307304
* Written to the state as if the node had simply returned this value instead of the Command object.
308305
*/
309-
update?: Record<string, unknown> | [string, unknown][];
306+
update?: Update | [string, unknown][];
310307

311308
/**
312309
* Value to resume execution with. To be used together with {@link interrupt}.
@@ -320,11 +317,11 @@ export class Command<
320317
* - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
321318
* - sequence of {@link Send} objects
322319
*/
323-
goto?: Nodes | Send<Nodes, Update> | (Nodes | Send<Nodes, Update>)[] = [];
320+
goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[] = [];
324321

325322
static PARENT = "__parent__";
326323

327-
constructor(args: CommandParams<Resume, Nodes | AnyString, Update>) {
324+
constructor(args: CommandParams<Resume, Update, Nodes>) {
328325
this.resume = args.resume;
329326
this.graph = args.graph;
330327
this.update = args.update;

0 commit comments

Comments
 (0)