Skip to content

Commit ebe4070

Browse files
committed
fix: Initialization of the selectedFields property on the GraphtonQueryReturnsObject mixin now works
1 parent 53c82bf commit ebe4070

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/stubs/GraphtonBaseQuery.stub.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export abstract class GraphtonBaseQuery<QueryResponse> {
2727
public abstract readonly queryName: string;
2828
public abstract readonly rootType: RootType;
2929

30+
constructor() {
31+
this.initGraphtonQueryReturnsObject();
32+
}
33+
34+
protected initGraphtonQueryReturnsObject(): void {}
35+
3036
/**
3137
* Get the return object format
3238
*/
@@ -82,8 +88,12 @@ export abstract class GraphtonBaseQuery<QueryResponse> {
8288

8389
type FieldSelectorTypeFormat = { [key: string]: ({} | FieldSelectorTypeFormat); };
8490
export abstract class GraphtonQueryReturnsObject<FieldSelectorType extends FieldSelectorTypeFormat, ReturnType extends { [p: string]: unknown }> {
85-
protected selectedFields: {root: Partial<FieldSelectorType>} = {root: {}};
86-
protected abstract readonly returnType: keyof typeof fieldObjectMap;
91+
protected selectedFields!: {root: Partial<FieldSelectorType>};
92+
protected readonly returnType!: keyof typeof fieldObjectMap;
93+
94+
protected initGraphtonQueryReturnsObject(): void {
95+
this.selectedFields = {root: {}};
96+
}
8797

8898
/**
8999
* Select fields that should be returned

0 commit comments

Comments
 (0)