Skip to content

Commit 1b4980f

Browse files
Update resolvers-map.md
1 parent ab48d82 commit 1b4980f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/graphql/resolvers-map.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ Usually your `@Args()` decorator will be simple, and not require an object argum
245245
In the `getAuthor()` case, the `number` type is used, which presents a challenge. The `number` TypeScript type doesn't give us enough information about the expected GraphQL representation (e.g., `Int` vs. `Float`). Thus we have to **explicitly** pass the type reference. We do that by passing a second argument to the `Args()` decorator, containing argument options, as shown below:
246246

247247
```typescript
248-
@Query(returns => Author, { name: 'author' })
249-
async getAuthor(@Args('id', { type: () => Int }) id: number) {
250-
return this.authorsService.findOneById(id);
251-
}
248+
@Query(returns => Author, { name: 'author' })
249+
async getAuthor(@Args('id', { type: () => Int }) id: number) {
250+
return this.authorsService.findOneById(id);
251+
}
252252
```
253253

254254
The options object allows us to specify the following optional key value pairs:

0 commit comments

Comments
 (0)