Skip to content

Typescript extends does not make static properties from base available in the child object #773

@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/ios-runtime/blob/master/src/NativeScript/__extends.js#L4 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 __());
    };
})();

Android runtime related issue: NativeScript/android#783

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions