Create decorator.ts

This commit is contained in:
Wener
2023-09-12 10:50:05 +02:00
committed by GitHub
parent 836230b7e7
commit e0b3d206c2

View File

@ -0,0 +1,24 @@
class Point {
private _x: number;
private _y: number;
constructor(x: number, y: number) {
this._x = x;
this._y = y;
}
@configurable(false)
get x() {
return this._x;
}
@configurable(false)
get y() {
return this._y;
}
}
function configurable(value: boolean) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
descriptor.configurable = value;
};
}