You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class with a static method - output from TS that gets fed into CC looks like
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "mobx"], function (require, exports, mobx) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MyClass = (function () {
function MyClass() {
}
MyClass.myMethod = function () {
console.log('myMethod');
};
return MyClass;
}());
goog.reflect.sinkValue(MyClass.myMethod)
__decorate([
mobx.action
], MyClass, goog.reflect.objectProperty("myMethod", MyClass), null);
MyClass.myMethod();
});
This gets compiled to:
(function() {
function k(c) {
k[" "](c);
return c
}
k[" "] = function() {}
;
var m = this && this.b || function(c, d, e, f) {
var g = arguments.length, a = 3 > g ? d : null === f ? f = Object.getOwnPropertyDescriptor(d, e) : f, h;
if ("object" === typeof Reflect && "function" === typeof Reflect.a)
a = Reflect.a(c, d, e, f);
else
for (var l = c.length - 1; 0 <= l; l--)
if (h = c[l])
a = (3 > g ? h(a) : 3 < g ? h(d, e, a) : h(d, e)) || a;
return 3 < g && a && Object.defineProperty(d, e, a),
a
}
;
function n() {}
function p() {
console.log("myMethod")
}
k(function() {
return p
});
m([mobx.action], n, "c", null);
p();
})();
You'll see that I am using sinkValue. And while the method is not technically inlined, it also is not kept on the class, so the decoration does not work.
The text was updated successfully, but these errors were encountered:
I don't think goog.reflect.sinkValue does what you think. Is there any way you can get a @nocollapse on the method? There's talk of trying to teach DisambiguateProperties to back off on statics, which would make the annotation unnecessary, but that's probably still a ways away.
Related to: #2437
I have a class with a static method - output from TS that gets fed into CC looks like
This gets compiled to:
You'll see that I am using
sinkValue
. And while the method is not technically inlined, it also is not kept on the class, so the decoration does not work.The text was updated successfully, but these errors were encountered: