Skip to content

Commit c0c8815

Browse files
longngnjohnbiundo
andauthored
Update content/graphql/mapped-types.md
Co-Authored-By: John Biundo <[email protected]>
1 parent 0009e56 commit c0c8815

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/graphql/mapped-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ 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 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:
38+
The `PartialType()` function takes an optional second argument that is a reference to a decorator factory. This argument can be used to change the decorator function applied to the resulting (*child*) class. If not specified, the child class effectively uses the same decorator as the *parent* class (the class referenced in the first argument). In the example above, we are extending `CreateUserInput` which is annotated with the `@InputType()` decorator. Since we want `UpdateUserInput` to also be treated as if it were decorated with `@InputType()`, we didn't need to pass `InputType` as the second argument. If the parent and child types are different, (e.g., the parent is decorated with `@ObjectType`), we would pass `InputType` as the second argument. For example:
3939

4040
```typescript
4141
@InputType()

0 commit comments

Comments
 (0)