https://github.com/younho9/not
Type guard based on exclude
https://github.com/younho9/not
guard guards ts type type-guard type-guards types typescript
Last synced: about 1 month ago
JSON representation
Type guard based on exclude
- Host: GitHub
- URL: https://github.com/younho9/not
- Owner: younho9
- License: mit
- Created: 2021-12-21T15:33:18.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-21T15:38:49.000Z (over 4 years ago)
- Last Synced: 2025-10-29T17:45:49.769Z (8 months ago)
- Topics: guard, guards, ts, type, type-guard, type-guards, types, typescript
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @younho9/not
[](https://github.com/younho9/not/actions/workflows/main.yml)
[](https://github.com/xojs/xo)
[](https://conventionalcommits.org)
> Type guard based on exclude
## Install
```sh
$ npm install @younho9/not
```
## Usage
```ts
import not from '@younho9/not';
const isNullable = (value: unknown): value is null | undefined =>
value === null || value === undefined;
const isNonNullable = not(isNullable);
declare const someValue: string | null | undefined;
if (isNonNullable(someValue)) {
someValue;
//=> string
}
```
## LICENSE
[MIT](LICENSE)