Skip to content

Commit a8748e6

Browse files
authored
Merge pull request #100 from wadetandy/master
Return assoc propertyDescriptor from decorators
2 parents 61026e1 + b557f24 commit a8748e6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsorm",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Javascript ORM",
55
"main": "lib/index.js",
66
"module": "lib-esm/index.js",

src/decorators.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,24 @@ type DecoratorArgs<T extends JSORMBase> =
129129
| AssociationFactoryOpts<T>
130130
| string
131131
| typeof JSORMBase
132-
/*
133-
* Yup that's a super-Java-y method name. Decorators in
132+
/*
133+
* Yup that's a super-Java-y method name. Decorators in
134134
* ES7/TS are either of the form:
135-
*
135+
*
136136
* @decorator foo : string
137-
* or
137+
* or
138138
* @decorator(options) foo : string
139-
*
140-
* The first is a function that directly decorates the
139+
*
140+
* The first is a function that directly decorates the
141141
* property, while this second is a factory function
142142
* that returns a decorator function.
143-
*
143+
*
144144
* This method builds the factory function for each of our
145-
* association types.
146-
*
145+
* association types.
146+
*
147147
* Additionally, users without decorator support can apply these
148148
* to their ES6-compatible classes directly if they prefer:
149-
*
149+
*
150150
* ``` javascript
151151
* class Person extends ApplicationRecord {
152152
* fullName() { `${this.firstName} ${this.lastName} `}
@@ -155,7 +155,7 @@ type DecoratorArgs<T extends JSORMBase> =
155155
* Attr(Person, 'lastName')
156156
* BelongsTo(Person, 'mother', { type: Person })
157157
* ```
158-
*
158+
*
159159
*/
160160

161161
const AssociationDecoratorFactoryBuilder = <T extends JSORMBase>(
@@ -220,7 +220,7 @@ const AssociationDecoratorFactoryBuilder = <T extends JSORMBase>(
220220
attrDefinition.owner = target.constructor
221221
attrDefinition.apply(ModelClass)
222222

223-
attrDefinition.descriptor()
223+
return attrDefinition.descriptor()
224224
}
225225

226226
if (isModelClass(targetOrConfig) && propertyKey) {

0 commit comments

Comments
 (0)