Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/valibot/src/utils/isOfKind/isOfKind.ts>isOfKind

The modular and type safe schema library for validating structural data 🤖
Go to Latest
function isOfKind
import { isOfKind } from "https://deno.land/x/valibot@v0.2.0-to-json-schema/src/utils/isOfKind/isOfKind.ts";

A generic type guard to check the kind of an object.

Type Parameters

TKind extends TObject["kind"]
TObject extends { kind: string; }

Parameters

kind: TKind

The kind to check for.

object: TObject

The object to check.

Returns

object is Extract<TObject, { kind: TKind; }>

Whether it matches.