Surface / foldkit-surface/declared

DeclaredConfig

type · packages/surface/src/declared.ts:68

type DeclaredConfig<
  Root,
  Message,
  AppTag extends string,
  Transitions extends Readonly<Record<string, unknown>>,
  Resources = never,
> = WritesOptions & {
  readonly sends?: SendsMap<EmitOf<Transitions>, AppTag> | undefined
  readonly foreign?: Expr.ReaderOptions['foreign'] | undefined
  readonly lazyTags?: ReadonlyArray<AppTag> | undefined
  readonly record?:
    ((step: SuppliedStep<Transitions, Message>) => void) | undefined
} & ([EmitOf<Transitions>] extends [never]
    ? {
        readonly commands?:
          CommandTable<never, Root, Message, Resources> | undefined
      }
    : {
        readonly commands: CommandTable<
          EmitOf<Transitions>,
          Root,
          Message,
          Resources
        >
      }) &
  ([SuppliedTag<Transitions>] extends [never]
    ? {
        readonly supply?: undefined
      }
    : {
        readonly supply: SupplyTable<Transitions, Message>
      }) &
  ([Exclude<AppTag, keyof Transitions>] extends [never]
    ? {
        readonly fallback?: undefined
      }
    : {
        readonly fallback: (
          model: Root,
          message: Exclude<
            Message,
            {
              readonly _tag: keyof Transitions & string
            }
          >,
        ) => Update.Return<Root, Message, Resources>
      })

Configuration for Declared.of.