Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
feat(gg): allow delegated-parent-resolvers (#429)
Browse files Browse the repository at this point in the history
closes #428
  • Loading branch information
Jason Kuhrt authored Feb 4, 2019
1 parent 76254f4 commit f661c4b
Show file tree
Hide file tree
Showing 3 changed files with 10,416 additions and 4,207 deletions.
13 changes: 10 additions & 3 deletions packages/graphqlgen/src/generators/ts-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,18 @@ const renderTypeResolver = (
`
}

const func = `
${params} => ${resolverReturnType(returnType)}
const func = `${params} => ${resolverReturnType(returnType)}`

const DelegatedParentResolver = `
{
fragment: string
resolver: ${func}
}
`

return func
const resolver = union([`(${func})`, DelegatedParentResolver])

return resolver
}

function renderResolvers(args: GenerateArgs): string {
Expand Down
Loading

0 comments on commit f661c4b

Please sign in to comment.