-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsTest.ts
More file actions
49 lines (43 loc) · 978 Bytes
/
Copy pathtsTest.ts
File metadata and controls
49 lines (43 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function classDecorator<T extends { new (...args: any[]): {} }>(
constructor: T
) {
return class a {
constructor(b: string) {}
};
}
function overrideFunction(fn: Function) {
return function (
target,
propertyKey: string,
descriptor: PropertyDescriptor
) {
descriptor.value = fn;
};
}
function override(f) {
return function (target, propertyKey, descriptor: PropertyDescriptor) {
return {
value: f,
configurable: false,
enumerable: false,
writable: false,
};
};
}
function propertyDec(target, propertyKey) {
console.log(target);
console.log(propertyKey);
}
class Greeter {
property = "property";
static staticProperty = "static";
constructor() {}
@override(function () {
console.log("another function");
})
hello() {
console.log(this.property);
}
}
const t = new Greeter();
t.hello();