Skip to content

support for indexOf #91

@wyattades

Description

@wyattades

As far as I can tell, this is the exact same reasoning as .includes (and may belong in the same entrypoint)? Happy to open a PR depending on your feedback.

Example:

// BEFORE
const users = ["matt", "sofia", "waqas"] as const;

// Argument of type '"bryan"' is not assignable to
// parameter of type '"matt" | "sofia" | "waqas"'.
users.indexOf("bryan");
// AFTER
import "@total-typescript/ts-reset/array-indexof"; // or array-includes?

const users = ["matt", "sofia", "waqas"] as const;

// .indexOf now takes a string as the first parameter
users.indexOf("bryan")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions