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

x/valibot/src/utils/index.ts>isOfType

The modular and type safe schema library for validating structural data 🤖
Latest
function isOfType
import { isOfType } from "https://deno.land/x/valibot@v1.0.0-beta.5/src/utils/index.ts";

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

Type Parameters

TType extends TObject["type"]
TObject extends { type: string; }

Parameters

type: TType

The type to check for.

object: TObject

The object to check.

Returns

object is Extract<TObject, { type: TType; }>

Whether it matches.