Feature - @InterfaceType decorator#46
Merged
felipesabino merged 7 commits intomasterfrom Nov 22, 2017
Merged
Conversation
| @@ -0,0 +1,25 @@ | |||
| /** | |||
| * Concats two arrays | |||
| * @param itemsA fist array argument | |||
5bc522e to
319390b
Compare
thiago-soliveira
approved these changes
Nov 21, 2017
| } else { | ||
| return items; | ||
| } | ||
| }, collection); |
There was a problem hiding this comment.
What about lodash.flatten and lodash.concat?
Author
There was a problem hiding this comment.
@thiago-soliveira Thought about that but I prefer avoid adding extra dependencies for very simple use cases whenever possible
tibawatanabe
approved these changes
Nov 22, 2017
| export function interfaceTypeFactory(target: any): graphql.GraphQLInterfaceType | undefined { | ||
| return getMetadataBuilder().buildInterfaceTypeMetadata(target) | ||
| .map(metadata => { | ||
| if (interfaceTypeCache[metadata.name]) { |
There was a problem hiding this comment.
Hum... what about:
if (!interfaceTypeCache[metadata.name]) {
interfaceTypeCache[metadata.name] = new ...
}
return interfaceTypeCache[metadata.name];| const fieldMetadataList: { target: Function, field: FieldMetadata}[] = getMetadataBuilder() | ||
| .buildFieldMetadata(target.prototype) | ||
| .map(field => ({ | ||
| target: target, |
There was a problem hiding this comment.
possible shorthand:
({ target, field })| name: arg.name, | ||
| description: arg.description, | ||
| isInput: arg.isInput, | ||
| interfaces: Array.prototype.concat.apply([], arg.interfaces.map(this.buildInterfaceTypeMetadata)), |
ffae888 to
0b2bbcf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@InterfaceTypedecorator - Create Interface Decorator #28@ObjectTypeclasses that implements the interface decorator but are not directly used anywhere else.@InterfaceTypeto Improve documentation #23 issue description for future improvement@InterfaceTypeto README