Skip to content

Commit 0009e56

Browse files
authored
Update graphql/mapped-types.md
1 parent 11a1247 commit 0009e56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/graphql/mapped-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export class UpdateUserInput extends PartialType(CreateUserInput) {}
3535

3636
> info **Hint** The `PartialType()` function is imported from the `@nestjs/graphql` package.
3737
38-
The `PartialType()` function takes an optional second argument that is a reference to the decorator factory of the type being extended. In the example above, we are extending `CreateUserInput` which is annotated with the `@InputType()` decorator. We didn't need to pass `InputType` as the second argument since it's the default value. If you want to extend a class decorated with `@ObjectType`, pass `ObjectType` as the second argument. For example:
38+
The `PartialType()` function takes an optional second argument that is a reference to the decorator factory of the child class. In the example above, we are extending `CreateUserInput` which is annotated with the `@InputType()` decorator. We didn't need to pass `InputType` as the second argument since the child class is also annotated with `@InputType()`. If you want to extend a class decorated with `@ObjectType`, pass `InputType` as the second argument. For example:
3939

4040
```typescript
4141
@InputType()
42-
export class UpdateUserInput extends PartialType(User, ObjectType) {}
42+
export class UpdateUserInput extends PartialType(User, InputType) {}
4343
```
4444

4545
#### Pick

0 commit comments

Comments
 (0)