// type A = {}; // type B = { prop?: string }; // type C = { prop: string }; // type TestA = MakeOptionalIfEmpty; // void | {} // type TestB = MakeOptionalIfEmpty; // void | { prop?: string } // type TestC = MakeOptionalIfEmpty; // { prop: string } import type { BlockStdScope } from '../scope/block-std-scope.js'; import type { cmdSymbol } from './consts.js'; export interface InitCommandCtx { std: BlockStdScope; } export type Cmds = { [cmdSymbol]: Command[]; }; export type Command = ( input: Input & InitCommandCtx, next: (output?: Output) => void ) => void; export type Chain = { [cmdSymbol]: Command[]; with: (input: Out) => Chain; pipe: { ( command: Command ): Chain; ( command: Command, input?: In ): Chain; }; try: ( commands: (chain: Chain) => Chain[] ) => Chain; tryAll: ( commands: (chain: Chain) => Chain[] ) => Chain; run: () => [false, Partial & InitCommandCtx] | [true, CommandCtx]; };