getDescriptor
Commons
stable
Walks the prototype chain of an object and returns the first property descriptor found for the given key. Works across the full inheritance hierarchy, not just own properties.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- objrequisany
- The object (or instance) to inspect. The function walks up via Object.getPrototypeOf until the key is found or the chain ends.
- keyrequisPropertyKey
- The property key to look for (string, number, or symbol).
API
Valeur de retour
La valeur retournée par cet util.
- The first matching PropertyDescriptor, or undefined when the key is not found anywhere in the chain.
Usage
Exemples
Extraits de code prêts à coller.
Read a getter from a prototype