Extremely Popular
Go to Latest
function hasProperty
import { hasProperty } from "https://dotland.deno.dev/x/discordeno@17.2.0/plugins/validations/deps.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>
import hasProperty
import { hasProperty } from "https://dotland.deno.dev/x/discordeno@17.2.0/plugins/validations/deps.ts";