Skip to content

Commit 9160f7d

Browse files
committed
docs(graphql): fix typo and add generics
1 parent a2e458e commit 9160f7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/graphql/guards-interceptors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async upvotePost(
8686

8787
> info **Hint** In the above example, we have assumed that the `user` object is assigned to the context of your GraphQL application.
8888
89-
#### Interceptors at the `@ResoleField()` method level
89+
#### Interceptors at the `@ResolveField()` method level
9090

9191
In a GraphQL context, interceptors [do not access the full GraphQL response](https://github.com/nestjs/graphql/issues/320#issuecomment-511193229): they only get the response of the `@Query()`/`@Mutation()` method, but not the complete response with the resolved fields. You can tell Nest to execute interceptors (as well as guards and filters) for methods annotated `@ResolveField()` by setting the `fieldResolverEnhancers` option in `GqlModuleOptions`:
9292

@@ -96,11 +96,11 @@ GraphQLModule.forRoot({
9696
}),
9797
```
9898

99-
> **Warning** Enabling interceptors for field resolvers can cause performance issues when you are returning lots of records and your field resolver is executed thousands of times. For this reason, when you enable `fieldResolverEnhancers`, we advise you to skip execution of interceptors that are not strictly necessary for your field resolvers. You can do this using the following helper method:
99+
> **Warning** Enabling interceptors for field resolvers can cause performance issues when you are returning lots of records and your field resolver is executed thousands of times. For this reason, when you enable `fieldResolverEnhancers`, we advise you to skip execution of interceptors that are not strictly necessary for your field resolvers. You can do this using the following helper function:
100100
101101
```typescript
102102
export function isResolvingGraphQLField(context: ExecutionContext): boolean {
103-
if (context.getType().toString() === 'graphql') {
103+
if (context.getType<GqlContextType>().toString() === 'graphql') {
104104
const gqlContext = GqlExecutionContext.create(context);
105105
const info = gqlContext.getInfo();
106106
const parentType = info.parentType.name;

0 commit comments

Comments
 (0)