getProp()function

getProp(obj: T, key: K): T[K]
ParamType
objT
The object to read the prop from. required
keyK
The key of the prop to read. required
Return
T[K]
The value of the named prop.

Extract the value of a named prop from an object.

Examples

getProp({ a: 1, b: 2 }, "a"); // 1