* Get the property descriptor of a property on an object or its prototype chain. * * @param obj - The object to get the property descriptor from. * @param prop - The property to get the descriptor for.
(obj: T, prop: keyof T)
| 11 | * @param prop - The property to get the descriptor for. |
| 12 | */ |
| 13 | function getPropertyDescriptor<T>(obj: T, prop: keyof T): PropertyDescriptor | null { |
| 14 | const descriptor = Object.getOwnPropertyDescriptor(obj, prop); |
| 15 | |
| 16 | if (descriptor) { |
| 17 | return descriptor; |
| 18 | } |
| 19 | |
| 20 | const proto = Object.getPrototypeOf(obj); |
| 21 | if (proto) { |
| 22 | return getPropertyDescriptor(proto, prop); |
| 23 | } |
| 24 | |
| 25 | return null; |
| 26 | } |
| 27 | |
| 28 | const TypedArray = Object.getPrototypeOf(Uint8Array); |
| 29 |