Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 560 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 560 Bytes

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