API reference@evolu/commonFunction › todo

function todo<T>(): T;

Defined in: packages/common/src/Function.ts:342

Development placeholder that always throws.

Use to sketch function bodies before implementing them. TypeScript infers the return type from context, so surrounding code still type-checks. Use an explicit generic when there is no return type annotation.

Example

import { assert, assertErr, assertType, todo, trySync } from "@evolu/common";

interface Config {
  readonly theme: string;
}

const getCount = (): number => todo();
const getConfig = () => todo<Config>();

assertType<
  [number, Config],
  [ReturnType<typeof getCount>, ReturnType<typeof getConfig>]
>();
const result = trySync(getCount);
assertErr(result);
assert(
  result.error instanceof Error &&
    result.error.message === "not yet implemented",
  "Expected the not-yet-implemented error.",
);