Skip to content

Commit

Permalink
fix(docs): add note about as const usage
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbash committed Jan 16, 2022
1 parent dbf8b83 commit c53303b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ResourceDto {
export class ResourceController {
@Method.Get('resource/:resourceId', {
permissions: ['resource.get'],
// !!! Do not forget to use `as const`, otherwise TypeScript reports type errors
responses: [Ok.Type(ResourceDto), NotFound.Type(NotFoundDto)] as const,
})
// You can remove return type annotation and still have type safety
Expand Down Expand Up @@ -90,7 +91,7 @@ import { FilmsService } from './films.service'

@ApiTags('films')
@Controller('films')
/* You need to transform typed responses to the ones accepted bt Nest.js */
/* You need to transform typed responses to the ones accepted by Nest.js */
@UseInterceptors(new TypedResponseInterceptor())
export class FilmsController {
constructor(private films: FilmsService) {}
Expand Down

0 comments on commit c53303b

Please sign in to comment.