is-interface
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

is-interface

Type Guard for interface

Install

npm install is-interface

Usage

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 - Type guards for any situation

LICENSE

MIT

Package Sidebar

Install

npm i is-interface

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

2.98 kB

Total Files

5

Last publish

Collaborators

  • younho9