type-array-includes-more
v1.0.0
Published
[![GitHub Actions CI](https://github.com/LumaKernel/type-array-includes-more/workflows/GitHub%20Actions%20CI/badge.svg)](https://github.com/LumaKernel/type-array-includes-more/actions?query=workflow%3A%22GitHub+Actions+CI%22)
Downloads
4
Readme
Type Array#includes more
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.