https://github.com/younho9/is-interface
Type Guard for interface
https://github.com/younho9/is-interface
guard guards ts type type-guard type-guards types typescript
Last synced: about 2 months ago
JSON representation
Type Guard for interface
- Host: GitHub
- URL: https://github.com/younho9/is-interface
- Owner: younho9
- License: mit
- Created: 2021-12-14T18:01:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-14T18:11:15.000Z (over 4 years ago)
- Last Synced: 2025-02-02T16:34:31.278Z (over 1 year ago)
- Topics: guard, guards, ts, type, type-guard, type-guards, types, typescript
- Language: JavaScript
- 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
# is-interface
> Type Guard for interface
## Install
```
npm install is-interface
```
## Usage
```ts
import is from "@sindresorhus/is";
import { isInterface } from "is-interface";
declare const someObject: unknown;
if (
isInterface(someObject, {
foo: is.string,
bar: is.number,
baz: is.boolean,
})
) {
someObject;
// const someObject: {
// foo: string;
// bar: number;
// baz: boolean;
// }
}
```
## Related
- [is](https://github.com/sindresorhus/is) - Type guards for any situation
## LICENSE
[MIT](LICENSE)