getProp()function
getProp(obj: T, key: K): T[K]
| Param | Type | |
|---|---|---|
obj | T | The object to read the prop from. required |
key | K | 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