Skip to content

Commit

Permalink
printSchema: replace array concat with spead + update comment (#3035)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Apr 11, 2021
1 parent 264f758 commit ff54195
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utilities/printSchema.js
Expand Up @@ -58,11 +58,11 @@ function printFilteredSchema(
const directives = schema.getDirectives().filter(directiveFilter);
const types = Object.values(schema.getTypeMap()).filter(typeFilter);

return [printSchemaDefinition(schema)]
.concat(
directives.map((directive) => printDirective(directive)),
types.map((type) => printType(type)),
)
return [
printSchemaDefinition(schema),
...directives.map((directive) => printDirective(directive)),
...types.map((type) => printType(type)),
]
.filter(Boolean)
.join('\n\n');
}
Expand Down Expand Up @@ -100,6 +100,7 @@ function printSchemaDefinition(schema: GraphQLSchema): ?string {
* schema {
* query: Query
* mutation: Mutation
* subscription: Subscription
* }
*
* When using this naming convention, the schema description can be omitted.
Expand Down

0 comments on commit ff54195

Please sign in to comment.