Skip to content

Commit 80b211e

Browse files
fix(common): add property decorator typing to apply decorators
1 parent 06f377c commit 80b211e

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

packages/common/decorators/core/apply-decorators.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@
88
* @publicApi
99
*/
1010
export function applyDecorators(
11-
...decorators: Array<ClassDecorator | MethodDecorator>
11+
...decorators: Array<ClassDecorator | MethodDecorator | PropertyDecorator>
1212
) {
1313
return <TFunction extends Function, Y>(
1414
target: TFunction | Object,
1515
propertyKey?: string | symbol,
1616
descriptor?: TypedPropertyDescriptor<Y>,
1717
) => {
18-
for (const decorator of decorators || []) {
19-
target instanceof Function
20-
? (decorator as ClassDecorator)(target)
21-
: (decorator as MethodDecorator)(target, propertyKey, descriptor);
18+
for (const decorator of decorators) {
19+
if (target instanceof Function) {
20+
(decorator as ClassDecorator)(target);
21+
continue;
22+
}
23+
(decorator as MethodDecorator | PropertyDecorator)(
24+
target,
25+
propertyKey,
26+
descriptor,
27+
);
2228
}
2329
};
2430
}

0 commit comments

Comments
 (0)