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

x/discordeno/util/utils.ts>hasProperty

Discord API library for Deno
Go to Latest
function hasProperty
import { hasProperty } from "https://deno.land/x/discordeno@17.0.1/util/utils.ts";

TS save way to check if a property exists in an object

Type Parameters

T extends { }
optional
Y extends PropertyKey = string

Parameters

obj: T
prop: Y

Returns

obj is T & Record<Y, unknown>