Skip to main content

hasProperty

@discordeno/utilsDocs


Documentation / @discordeno/utils / hasProperty

Function: hasProperty()

hasProperty<T, Y>(obj, prop): obj is T & Record<Y, unknown>

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

Type Parameters

T extends object

Y extends PropertyKey = string

Parameters

obj: T

prop: Y

Returns

obj is T & Record<Y, unknown>

Defined in

packages/utils/src/utils.ts:14