summaryrefslogtreecommitdiff
path: root/cli/tests/ts_decorators_bundle.ts
blob: 189edfbff3ddab5a9e320367f8b5dd83f268de23 (plain)
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
// deno-lint-ignore-file

import { B } from "./subdir/more_decorators.ts";

function Decorator() {
  return function (
    target: Record<string, any>,
    propertyKey: string,
    descriptor: TypedPropertyDescriptor<any>,
  ) {
    const originalFn: Function = descriptor.value as Function;
    descriptor.value = async function (...args: any[]) {
      return await originalFn.apply(this, args);
    };
    return descriptor;
  };
}

class SomeClass {
  @Decorator()
  async test(): Promise<void> {}
}

new SomeClass().test();
new B().method();