Skip to content

Commit

Permalink
Use consistent typing for meta
Browse files Browse the repository at this point in the history
  • Loading branch information
eddeee888 committed Aug 22, 2024
1 parent 3034c9a commit 89be355
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface ParsedResolversConfig extends ParsedConfig {
}

type FieldDefinitionPrintFn = (parentName: string, avoidResolverOptionals: boolean) => string | null;
interface RootResolverResult {
export interface RootResolver {
content: string;
generatedResolverTypes: {
resolversMap: { name: string };
Expand Down Expand Up @@ -1285,12 +1285,12 @@ export class BaseResolversVisitor<
return this._hasFederation;
}

public getRootResolver(): RootResolverResult {
public getRootResolver(): RootResolver {
const name = this.convertName(this.config.allResolversTypeName);
const declarationKind = 'type';
const contextType = `<ContextType = ${this.config.contextType.type}>`;

const userDefinedTypes: RootResolverResult['generatedResolverTypes']['userDefined'] = {};
const userDefinedTypes: RootResolver['generatedResolverTypes']['userDefined'] = {};
const content = [
new DeclarationBlock(this._declarationBlockConfig)
.export()
Expand Down
7 changes: 2 additions & 5 deletions packages/plugins/typescript/resolvers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PluginFunction,
Types,
} from '@graphql-codegen/plugin-helpers';
import { parseMapper } from '@graphql-codegen/visitor-plugin-common';
import { parseMapper, type RootResolver } from '@graphql-codegen/visitor-plugin-common';
import { GraphQLSchema } from 'graphql';
import { TypeScriptResolversPluginConfig } from './config.js';
import { TypeScriptResolversVisitor } from './visitor.js';
Expand All @@ -15,10 +15,7 @@ const capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1)
export const plugin: PluginFunction<
TypeScriptResolversPluginConfig,
Types.ComplexPluginOutput<{
generatedResolverTypes: {
resolversMap: { name: string };
userDefined: Record<string, { name: string }>;
};
generatedResolverTypes: RootResolver['generatedResolverTypes'];
}>
> = (schema: GraphQLSchema, documents: Types.DocumentFile[], config: TypeScriptResolversPluginConfig) => {
const imports = [];
Expand Down

0 comments on commit 89be355

Please sign in to comment.