Skip to content

Commit d7d0640

Browse files
Update swagger.md
1 parent 8868b4a commit d7d0640

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/recipes/swagger.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class CreateCatDto {
220220
We can pick a set of properties from this class using the `PickType()` utility function:
221221

222222
```typescript
223-
export class UpdateCatAgeDto extends PickType(CreateCatDto, ['age']) {}
223+
export class UpdateCatAgeDto extends PickType(CreateCatDto, ['age'] as const) {}
224224
```
225225

226226
> info **Hint** The `PickType()` function is imported from the `@nestjs/swagger` package.
@@ -245,7 +245,7 @@ export class CreateCatDto {
245245
We can generate a derived type that has every property **except** `name` as shown below. In this construct, the second argument to `OmitType` is an array of property names.
246246

247247
```typescript
248-
export class UpdateCatDto extends OmitType(CreateCatDto, ['name']) {}
248+
export class UpdateCatDto extends OmitType(CreateCatDto, ['name'] as const) {}
249249
```
250250

251251
> info **Hint** The `OmitType()` function is imported from the `@nestjs/swagger` package.
@@ -282,7 +282,7 @@ The type mapping utility functions are composable. For example, the following wi
282282

283283
```typescript
284284
export class UpdateCatDto extends PartialType(
285-
OmitType(CreateCatDto, ['name']),
285+
OmitType(CreateCatDto, ['name'] as const),
286286
) {}
287287
```
288288

0 commit comments

Comments
 (0)