Skip to main content

ignore

Callable

  • ignore(anyValue: unknown): void

  • Always return undefined and ignore passed value.

    This should be used in conjunction with eslint rules such as @typescript-eslint/no-misused-promises to explicitly ignore a promise returned by a callback.

    @example
    const doSomething = () => 'foo'; // string
    const doSomethingIgnore = () => ignore(doSomething()); // undefined as void

    const doAsync = async () => 'foo'; // Promise<string>
    const doSyncIgnore = () => ignore(doAsync()); // undefined as void