Skip to content

Lodash chain methods uses wrong generic type #14337

@asfernandes

Description

@asfernandes

// Type definitions for Lo-Dash 4.14

This interface (and others) uses wrong types. Type <T> should not be used in the method name, only in the interface.

    interface LoDashExplicitArrayWrapper<T> {
        /**
         * @see _.head
         */
        first<T>(): T;
    }

To make this code use correct type:

let a = _([1, 2, 3])
	.chain()
	.first();

Currently this code makes a with type {}.

Definition of interface should be as below, to make a of type number.

    interface LoDashExplicitArrayWrapper<T> {
        /**
         * @see _.head
         */
        first(): T;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions