Skip to content

Typesctipt extends does not make static properties from base available in the child object #783

@PeterStaev

Description

@PeterStaev

This is not for native objects but for JS ones. So I have the following:

class Base {
   public static test = [1, 2, 3];
}
class Child extends Base {}
console.log(Child.test);

From what I see this is because the TS extend function here: https://github.com/NativeScript/android-runtime/blob/a045a43b08953d8cc5c0093fc833a3ca26320ec2/android-static-binding-generator/tests/cases/decorated_extends_ts/internal/ts_helpers.js#L2 is not updated to the new one which also copies static properties:

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();

iOS runtime related issue: NativeScript/ios-jsc#773

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions