Type alias AsQueryMethod<T>

AsQueryMethod<T>: ((...args) => ReturnType<T>)

Type Parameters

  • T extends ((...args) => any)

Type declaration

    • (...args): ReturnType<T>
    • Gets the signature (parameters with their types, and the return type) of a function type.

      Parameters

      • Rest ...args: Parameters<T>
        Rest

      Returns ReturnType<T>

      Description

      Should be used when defining an interface for a class that uses query methods.

      Example

      function sendMessage(recipient: string, sender: string, priority: number, retryIfFails: boolean) {
      // some logic...
      return true;
      }

      // Both of the following types will be identical.
      type SendMessageType = AsQueryMethod<typeof sendMessage>;
      type SendMessageManualType = (recipient: string, sender: string, priority: number, retryIfFails: boolean) => boolean;

Generated using TypeDoc