JSPM

is-interface

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q11836F
  • License MIT

Type Guard for interface

Package Exports

  • is-interface

Readme

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;
  // }
}
  • is - Type guards for any situation

LICENSE

MIT