feat(types): make graphql type parameters not required

This commit is contained in:
Sibelius Seraphini
2019-01-07 12:46:42 -02:00
parent 327548b830
commit 2950e9c28d
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ export default class QueryComplexity {
onOperationDefinitionEnter(operation: OperationDefinitionNode): void;
onOperationDefinitionLeave(): GraphQLError | undefined;
nodeComplexity(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode |
OperationDefinitionNode, typeDef: GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType, complexity?: number): number;
OperationDefinitionNode, typeDef: GraphQLObjectType<any, any> | GraphQLInterfaceType | GraphQLUnionType, complexity?: number): number;
createError(): GraphQLError;
getDefaultComplexity(args: object, childScore: number): number;
}
+2 -2
View File
@@ -49,8 +49,8 @@ const resolve: GraphQLFieldResolver<any, any> = (source, args, context, info) =>
context.flag = "f";
};
const fields: GraphQLFieldConfigMap<any, any> = {};
let t: GraphQLObjectType;
let e: GraphQLObjectType;
let t: GraphQLObjectType<any, any>;
let e: GraphQLObjectType<any, any>;
const def = connectionDefinitions({
connectionFields: fields,
edgeFields: fields,
+5 -5
View File
@@ -56,7 +56,7 @@ export const connectionArgs: GraphQLFieldConfigArgumentMap & ForwardConnectionAr
export type ConnectionConfigNodeTypeNullable =
| GraphQLScalarType
| GraphQLObjectType
| GraphQLObjectType<any, any>
| GraphQLInterfaceType
| GraphQLUnionType
| GraphQLEnumType;
@@ -75,8 +75,8 @@ export interface ConnectionConfig {
}
export interface GraphQLConnectionDefinitions {
edgeType: GraphQLObjectType;
connectionType: GraphQLObjectType;
edgeType: GraphQLObjectType<any, any>;
connectionType: GraphQLObjectType<any, any>;
}
/**
@@ -256,8 +256,8 @@ export interface GraphQLNodeDefinitions {
nodesField: GraphQLFieldConfig<any, any>;
}
export type typeResolverFn = ((any: any) => GraphQLObjectType) |
((any: any) => Promise<GraphQLObjectType>);
export type typeResolverFn = ((any: any) => GraphQLObjectType<any, any>) |
((any: any) => Promise<GraphQLObjectType<any, any>>);
/**
* Given a function to map from an ID to an underlying object, and a function
+1 -1
View File
@@ -342,7 +342,7 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
* });
*
*/
export class GraphQLObjectType<TSource, TContext> {
export class GraphQLObjectType<TSource = any, TContext = any> {
name: string;
description: Maybe<string>;
astNode: Maybe<ObjectTypeDefinitionNode>;