An open API service indexing awesome lists of open source software.

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

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)