OmitType "omits" @Transform decorators
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I have a base class DTO for query params(using validation and @Transform decorators). When extending this with OmitType
the validation decorators are taken into consideration, but not the @Transform. As a result, cannot create reusable objects and validation fails due to missing transformation(e.g from string to Date etc.)
Extending the class in the “normal” way it works like expected
Edit: Actually this seems to manifest when having a bigger class hierarchy QueryParamsDto ExtraQueryParamsDto extends QueryParamsDto FinalQueryParamsDto extends OmitType(ExtraQueryParamsDto, [‘some_property’])
It seems in the FinalQueryParamsDto tranformation decorators are not picked up if defined in the base class QueryParamsDto
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Mapped Types - OpenAPI - A progressive Node.js framework
Omit #. The OmitType() function constructs a type by picking all properties from an input type and then removing a particular set of...
Read more >Introducing Mapped Types for NestJS - Trilon Consulting
We've used the @ApiProperty() decorator to make properties ... Hint The OmitType() function is imported from the @nestjs/graphql package.
Read more >Documentation - Utility Types - TypeScript
Omit<Type, Keys> ... Constructs a type by picking all properties from Type and then removing Keys (string literal or union of string literals)....
Read more >ValidationPipes doesnt work with Body specific type
I think the problem is when i try to use Omit<SCHEMA, OMIT_VALUE> on body type, then i feels like my validator ignore my...
Read more >typescript-cheatsheet - GitHub Pages
The cheatsheet contains references to types, classes, decorators, ... Omit type when extending an interface; Omitting specific properties when extending an ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems still actual
In the controller
Expected
enterprisesIds
should be[ 'helloWorld' ]
Actual
enterprisesIds
equalshelloWorld
If it’s still actually happened does someone want to provide a minimum reproduction repository like Kamil has already asked?