Skip to content

Commit

Permalink
fix: Interface & Union type composers on addTypeResolver now automa…
Browse files Browse the repository at this point in the history
…tically add provided types to schema
  • Loading branch information
nodkz committed May 10, 2020
1 parent f07ebad commit b506bd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/InterfaceTypeComposer.js
Expand Up @@ -1092,6 +1092,7 @@ export class InterfaceTypeComposer<TSource, TContext> {
const typeResolversMap = this.getTypeResolvers();
typeResolversMap.set(type, checkFn);
this.setTypeResolvers(typeResolversMap);
this.schemaComposer.addSchemaMustHaveType(type);
return this;
}

Expand Down
1 change: 1 addition & 0 deletions src/UnionTypeComposer.js
Expand Up @@ -621,6 +621,7 @@ export class UnionTypeComposer<TSource, TContext> {
const typeResolversMap = this.getTypeResolvers();
const tc = this._convertObjectType(type);
typeResolversMap.set(tc, checkFn);
this.schemaComposer.addSchemaMustHaveType((tc: any));
this.setTypeResolvers(typeResolversMap);
return this;
}
Expand Down

0 comments on commit b506bd5

Please sign in to comment.