Skip to content

Commit ec9f325

Browse files
committed
fix(repository): use PropertyType instead of Function
Fix `property.array()` to accept any kind of PropertyType, most notably `TypeResolver<T>`, not just functions (class constructors).
1 parent 4764166 commit ec9f325

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/repository/src/decorators/model.decorator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ModelDefinition,
1515
ModelDefinitionSyntax,
1616
PropertyDefinition,
17+
PropertyType,
1718
RelationDefinitionMap,
1819
} from '../model';
1920
import {RELATIONS_KEY} from './relation.decorator';
@@ -104,12 +105,13 @@ export namespace property {
104105

105106
/**
106107
*
107-
* @param itemType The class of the array to decorate
108+
* @param itemType The type of array items.
109+
* Examples: `number`, `Product`, `() => Order`.
108110
* @param definition Optional PropertyDefinition object for additional
109111
* metadata
110112
*/
111113
export function array(
112-
itemType: Function,
114+
itemType: PropertyType,
113115
definition?: Partial<PropertyDefinition>,
114116
) {
115117
return function(target: Object, propertyName: string) {

0 commit comments

Comments
 (0)