hasProperty
@discordeno/utils • Docs
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>