class-transformer
class-transformer copied to clipboard
fix: DiscriminatorDescriptor interface now accepts number, too
When using an enum as name it works fine by adding //@ts-ignore but the interface didnt allow that.
@ValidateNested()
@Type(() => MyDto, {
discriminator: {
property: 'type',
subTypes: [
{value: MySubDto1, name: MyEnum.Something},
{value: MySubDto2, name: MyEnum.SomethingOther},
],
},
keepDiscriminatorProperty: true,
})
cupData: MySubDto1 | MySubDto2;
Description
I changed the interface to accept string OR number.
Checklist
- [x] the pull request title describes what this PR does (not a vague title like
Update index.md) - [ x the pull request targets the default branch of the repository (
develop) - [x] the code follows the established code style of the repository
npm run prettier:checkpassesnpm run lint:checkpasses
- [ ] tests are added for the changes I made (if any source code was modified)
- [ ] documentation added or updated
- [x] I have run the project locally and verified that there are no errors
Not sure what I can do about the semantic pull request but if one of the maintainers might fix it or tell me what to do that would be awesome :)
Can this be merged?
@NoNameProvided
Sorry @NoNameProvided I dont understand what is meant with semantic commit and pr title. This is just a very very simple change in the TS interface but the PR is open for more than 4 months now :(
Its been 2.5 years and the issue still persists. Can this PR finally be merged? @NoNameProvided