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
functiondec(): Function{returnfunction(target: any,propKey: string,descr: PropertyDescriptor): void{console.log(target[propKey]);//logs undefined//propKey has three underscores as prefix, but the method has only two underscores};}classA{
@dec()private__foo(bar: string): void{// do something with bar}}
Expected behavior: target[propKey] should point to the decorated method
Actual behavior: target[propKey] is undefined
My workaround is checking the property key in the decorator and deleting the first one underscore at the moment.
As far as I can tell the problem exists since typescript 2.1
Edit: updated code to reproduce problem when compiling
TypeScript Version: 2.1.1
Code
Expected behavior:
target[propKey]should point to the decorated methodActual behavior:
target[propKey]is undefinedMy workaround is checking the property key in the decorator and deleting the first one underscore at the moment.
As far as I can tell the problem exists since typescript 2.1
Edit: updated code to reproduce problem when compiling