tst-reflect icon indicating copy to clipboard operation
tst-reflect copied to clipboard

Unable to access parameter decorators

Open avin-kavish opened this issue 3 years ago • 2 comments

function a(obj: Object, key: string, prop: number) {}

class Foo {
  boo?: boolean | null

  foo(@a x: string) {}
}

console.dir(
  getType<Foo>()
    .getMethods()
    .map(p => p.getParameters().map(p => p.type.getDecorators())),
)

Returns empty, I think getDecorators should be on the parameter itself and not the type?

avin-kavish avatar Sep 07 '22 05:09 avin-kavish

You are accessing decorators of the type, ie. you are accessing decorators of the string type, which has no decorators. There are no parameter decorators yet.

Hookyns avatar Sep 09 '22 09:09 Hookyns

Implemented for the v1. Not in the current version.

Hookyns avatar Sep 16 '22 06:09 Hookyns