object-properties
    Preparing search index...

    Function definePrototypeProperty

    • Defines a property on a class prototype

      Type Parameters

      • T extends { prototype: unknown }
      • P extends string
      • V

      Parameters

      • Class: T
      • property: P

        name of the property

      • value: V

        value

      • Optionaloptions: DefinePropertyOptions
        • Optionalconfigurable?: boolean
        • Optionalenumerable?: boolean
        • Optionalwritable?: boolean

      Returns any

      target

      class Person {}
      definePrototypeProperty(Person, 'species', 'human');
      const person = new Person();
      console.log(person.species); // 'human'