Skip to content

List of deprecated members #7964

@marklundin

Description

@marklundin

@playcanvas/react performs simple validation of engine props at runtime. It would be useful to exclude any deprecated members. Adding something like the following would help provide a list of deprecated members

const deprecated = new Set()

function markDeprecated(obj, memberName, descriptor) {
  Object.defineProperty(obj, memberName, descriptor);
  deprecated.add(`${obj.name}.${memberName}`); // use a better key here
}

// Example usage
markDeprecated(Texture.prototype, 'rgbm', { 
  get: function () {
    Debug.deprecated('pc.Texture#rgbm is deprecated. Use pc.Texture#type instead.');
    return this.type === TEXTURETYPE_RGBM;
  },
  set: function (rgbm) {
    Debug.deprecated('pc.Texture#rgbm is deprecated. Use pc.Texture#type instead.');
    this.type = rgbm ? TEXTURETYPE_RGBM : TEXTURETYPE_DEFAULT;
  }
})

export { deprecated }

This would give a current list of deprecated members. Any thoughts @mvaligursky ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions