Skip to main content

hasProperty

@discordeno/bot


Documentation / @discordeno/bot / hasProperty

Function: hasProperty()

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

Defined in: packages/utils/dist/types/utils.d.ts:4

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>