Skip to content

younho9/is-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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