Accessing private property with typescript Decorator

Asked

Viewed 34 times

1

In Typescript, is it possible to access a private property from the developer? An example of the code I’ve already made

class A {
    @dec
    private _teste: string = 'teste'
constructor(){}
public get teste() { return this._teste + '1' } }

function(target: any, key: string){
    const value = target[key]  //sempre retorna undefined
}

In the developer I can’t access either the value or the property itself. Is there any way to access and manipulate the _test property?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.