Skip to content

Commit fb83d8b

Browse files
committed
fix(ts): revise Relation defination
1 parent 231a9ba commit fb83d8b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

storage.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,26 +221,26 @@ export class GeoPoint extends BaseObject {
221221
* A class that is used to access all of the children of a many-to-many relationship.
222222
* Each instance of AV.Relation is associated with a particular parent object and key.
223223
*/
224-
export class Relation extends BaseObject {
224+
export class Relation<T extends Queriable> extends BaseObject {
225225
parent: Object;
226226
key: string;
227227
targetClassName: string;
228228

229229
constructor(parent?: Object, key?: string);
230-
static reverseQuery(
231-
parentClass: string,
230+
static reverseQuery<U extends Queriable>(
231+
parentClass: string | U,
232232
relationKey: string,
233233
child: Object
234-
): Query<any>;
234+
): Query<U>;
235235

236236
//Adds a AV.Object or an array of AV.Objects to the relation.
237-
add(object: Object): void;
237+
add(object: T): void;
238238

239239
// Returns a AV.Query that is limited to objects in this relation.
240-
query(): Query<any>;
240+
query(): Query<T>;
241241

242242
// Removes a AV.Object or an array of AV.Objects from this relation.
243-
remove(object: Object): void;
243+
remove(object: T): void;
244244
}
245245

246246
/**
@@ -318,7 +318,7 @@ export class Object extends BaseObject {
318318
op(attr: string): any;
319319
previous(attr: string): any;
320320
previousAttributes(): any;
321-
relation(attr: string): Relation;
321+
relation<T extends Queriable>(attr: string): Relation<T>;
322322
remove(attr: string, item: any): this;
323323
save(
324324
attrs?: object | null,
@@ -600,8 +600,8 @@ export class SearchSortBuilder {
600600
export class Role extends Object {
601601
constructor(name: string, acl: ACL);
602602

603-
getRoles(): Relation;
604-
getUsers(): Relation;
603+
getRoles(): Relation<Role>;
604+
getUsers(): Relation<User>;
605605
getName(): string;
606606
setName(name: string): Role;
607607
}

0 commit comments

Comments
 (0)