UNPKG

type-plus

Version:
31 lines 1.36 kB
import type { AnyFunction } from '../function/any_function.js'; import type { RecursivePartial } from '../object/recursive_partial.js'; import type { NoInfer } from '../type/no_infer.js'; /** * stub a value. * * If the value is a function, it will be passed through as-is. * * 🦴 `utilities` */ export declare function stub<T extends AnyFunction>(stub: T): T; export declare function stub<T>(stub: RecursivePartial<NoInfer<T>>): T; export declare namespace stub { var build: <T>(init: RecursivePartial<T> | ((stub?: RecursivePartial<T> | undefined) => RecursivePartial<T>)) => (stub?: RecursivePartial<T> | undefined) => T; var builder: <T>(init: RecursivePartial<T> | ((stub?: RecursivePartial<T> | undefined) => RecursivePartial<T>)) => { /** * Adds an init object or handler to the builder. * * If `init` is an object, it will be merged with the stub object. * If `init` is a function, it will be called with the stub object. * * @return {Builder<T>} The builder instance. */ with(init: RecursivePartial<T> | ((stub?: RecursivePartial<T> | undefined) => RecursivePartial<T>)): any; /** * Creates the resulting stub function. */ create(): (stub?: RecursivePartial<T> | undefined) => T; }; } //# sourceMappingURL=stub.d.ts.map