type-array-includes-more

    1.0.0 • Public • Published

    Type Array#includes more

    GitHub Actions CI

    Cool overrideing Array#include

    const tag: string = getTag();
    const arr = ["a", "div"] as const
    if (arr.includes(tag)) { // 😒 Error: Argument of type 'string' is not...
      tag;
    }
    
    // After installing this....
    if (arr.includes(tag)) {
      tag; // 😁 string , and also known as "a" | "div"
    }

    Installation

    npm i -D type-array-includes-more

    Usage

    Update your tsconfig.json like below.

     {
       "compilerOptions": {
         "strict": true,
         "lib": ["es2019"],
    +    "typeRoots": [
    +       "node_modules/@types",
    +       "node_modules/type-array-includes-more"
    +    ]
       }
     }

    Contributing

    Feel free to customize. This is distributed under public domain.

    Keywords

    none

    Install

    npm i type-array-includes-more

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    public domain

    Unpacked Size

    5.04 kB

    Total Files

    5

    Last publish

    Collaborators

    • lumax