assertProp()function

assertProp(obj: T, key: PropertyKey): asserts key is keyof T
ParamType
objT
The object to assert against. required
keyPropertyKey
The key to assert is an own prop. required
Return
asserts key is keyof T
Throws
RequiredError
If key is not an own prop of obj.

Assert that an unknown value is the key for an own prop of an object.