Skip to main content
Deno 2 is finally here 🎉️
Learn more
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@v1.0.0-beta.1-i18n/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.