Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

630 B
Raw Blame
const safeCallables = new WeakSet<(...args: never[]) => unknown>();

/**
 * Marks a host function as callable by the Custom JSX interpreter.
 *
 * The interpreter never calls an arbitrary function obtained from data or a
 * prototype. Host helpers must opt in through this module instead.
 */
export function createSafeCallable<T extends (...args: never[]) => unknown>(callable: T): T {
  safeCallables.add(callable);
  return callable;
}

export function isSafeCallable(value: unknown): value is (...args: never[]) => unknown {
  return typeof value === "function" && safeCallables.has(value as (...args: never[]) => unknown);
}