Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

473 B
Raw Blame
export const setNamespace = (namespace: string) => {
  return <P = undefined>(type: string, payload?: P) => {
    const name = [namespace, type].filter(Boolean).join('/');
    return (
      payload
        ? {
            payload,
            type: name,
          }
        : name
    ) as P extends undefined ? string : { payload: P; type: string };
  };
};

export type Action =
  | string
  | {
      [x: string | number | symbol]: unknown;
      type: string;
    };