Skip to content

Commit 09fee06

Browse files
authored
adds typescript declarations (#284)
1 parent 219b28f commit 09fee06

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

index.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { ASTNode, GraphQLError, ValidationContext } from 'graphql';
2+
3+
export interface ComplexityLimitRuleOptions {
4+
onCost?: (cost: number, context: ValidationContext) => void;
5+
createError?: (cost: number, node: ASTNode) => GraphQLError;
6+
formatErrorMessage?: (cost: number) => string;
7+
8+
scalarCost?: number;
9+
objectCost?: number;
10+
listFactor?: number;
11+
introspectionListFactor?: number;
12+
}
13+
14+
export function createComplexityLimitRule(
15+
maxCost: number,
16+
options?: ComplexityLimitRuleOptions,
17+
): (ctx: ValidationContext) => any;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "graphql-validation-complexity",
33
"version": "0.4.2",
44
"description": "Query complexity validation for GraphQL.js",
5+
"typings": "index.d.ts",
56
"files": [
67
"lib"
78
],

0 commit comments

Comments
 (0)