Skip to content

Tighten array's higer-order method declarations #7

Closed
@yskkin

Description

@yskkin

[0, 1, 2, null, undefined].filter(x => x) unintendedly (for me) evaluates to [1, 2].

What do you think about changing declaration of Array.prototype.filter (or any higher-order function which takes predicate) to

    filter(predicate: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];

from

    filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];

I manually changing lib-es5 from better-typescript-lib and that works good for my project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions