@pragmatically-typed/array.includes
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Using includes on a const array is a pain. This patch allows a broader type to be passed to includes and uses a type predicate to narrow the type. A common example is using a const array to represent valid states. Often we'll want to check if a generic string coming from user input is a valid state, this patch allows us to use .includes for that.

/@pragmatically-typed/array.includes/

    Package Sidebar

    Install

    npm i @pragmatically-typed/array.includes

    Weekly Downloads

    8

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    1.42 kB

    Total Files

    3

    Last publish

    Collaborators

    • jfleckenstein