Skip to content

Commit

Permalink
feat(schema-builder): update BuildSchemaOptions.orphanedTypes
Browse files Browse the repository at this point in the history
Function[] -> (Function | object)[]
  • Loading branch information
greatSumini committed Oct 30, 2021
1 parent ad1ee42 commit e03a71e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/interfaces/build-schema-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export interface BuildSchemaOptions {
scalarsMap?: ScalarsTypeMap[];

/**
* Orphaned type classes that are not explicitly used in GraphQL types definitions
* Orphaned type classes/enums that are not explicitly used in GraphQL types definitions
*/
orphanedTypes?: Function[];
orphanedTypes?: (Function | object)[];

/**
* Disable checking on build the correctness of a schema
Expand Down
5 changes: 2 additions & 3 deletions lib/schema-builder/storages/type-metadata.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class TypeMetadataStorageHost {
this.params.push(metadata);
}

compile(orphanedTypes: Function[] = []) {
compile(orphanedTypes: (Function | object)[] = []) {
this.classDirectives.reverse();
this.classExtensions.reverse();
this.fieldDirectives.reverse();
Expand All @@ -237,8 +237,7 @@ export class TypeMetadataStorageHost {
this.compileExtendedResolversMetadata();

orphanedTypes
.filter((type) => type && type.prototype)
.forEach((type) => this.applyPluginMetadata(type.prototype));
.forEach((type) => 'prototype' in type && this.applyPluginMetadata(type.prototype));
}

loadClassPluginMetadata(metadata: ClassMetadata[]) {
Expand Down

0 comments on commit e03a71e

Please sign in to comment.