Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/valibot/mod.ts>isOfType

The modular and type safe schema library for validating structural data 🤖
Extremely Popular
Latest
function isOfType
import { isOfType } from "https://deno.land/x/valibot@v0.35.0/mod.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.