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

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

The modular and type safe schema library for validating structural data 🤖
Go to Latest
function isOfType
import { isOfType } from "https://deno.land/x/valibot@v0.1.0-to-json-schema/src/utils/isOfType/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.