Class EsSignature<TArgs>

Function signature declaring function arguments.

Contains named argument args.

Can be used to declare functions and to call it.

Type Parameters

  • out TArgs extends Args = Args

    Type of arguments definition.

Hierarchy

  • EsSignature

Implements

Constructors

  • Constructs function signature.

    Signature arguments is an object literal containing argument keys and corresponding argument definitions. Keys are argument names with modifiers.

    Type Parameters

    • out TArgs extends Args<string> = Args<string>

    Parameters

    • args: TArgs

      Definition os signature arguments.

    Returns EsSignature<TArgs>

    Example

    new EsSignature({
    requiredArg: { comment: 'This argument should be specified in function call' },
    'optionalArg?': { comment: 'This argument may be omitted' },
    '...rest': { comment: 'This argument amy have multiple values' },
    });

Accessors

Methods

  • Checks whether a function with this signature accepts arguments provided for another one.

    Requires argument names to match, and all required arguments present.

    Parameters

    • another: EsSignature<Args<string>>

      Another signature the substituted arguments provided for.

    Returns boolean

    true is signatures compatible, or false otherwise.

  • Creates signature from the given input.

    Builds new signature from input arguments definition.

    Returns input signature instance as is.

    Type Parameters

    • TArgs extends Args<string>

    Parameters

    • input: TArgs | EsSignature<TArgs>

      Either function signature or arguments definition.

    Returns EsSignature<TArgs>

    Signature instance.

Generated using TypeDoc