Skip to main content

CommonDeprecateFunction

Callable

  • CommonDeprecateFunction<T>(oldName: string, callback: T, namespace?: Record<string, any>): void

  • Assign a function to the passed namespace, creating a deprecated and non-deprecated symbol. Both symbols will are in fact get/set wrappers around the same object, enforcing that namespace[oldName] === namespace[callback.name] always holds.

    @example
    CommonDeprecateFunction(
    "OldFunc",
    function NewFunc (a, b) { return a + b; },
    );

    Type parameters

    • T: (...any: any[]) => any

    Parameters

    • oldName: string

      The old (deprecated) name of the symbol

    • callback: T

      The function with its new name

    • namespace: Record<string, any> = globalThis

      The namespace wherein the new and old names will be stored

    Returns void