You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When extends using OmitType(), the derived class does not contain Base class methods.
Expected behavior
Expect derived class to have parent class methods
Minimal reproduction of the problem with instructions
import { IsString } from 'class-validator';
import { OmitType } from '@nestjs/mapped-types';
import { plainToClass } from 'class-transformer';
class BaseClass {
@IsString()
a: string;
@IsString()
b: string;
someMethod() {
return 'this is a method';
}
}
class DerivedClass extends OmitType(BaseClass, ['a']) {}
const instance = plainToClass(DerivedClass, {
b: 'some value',
});
console.log(instance.someMethod());
expect this code to log this is a method but it will throw the following error:
console.log(instance.someMethod());
^
TypeError: instance.someMethod is not a function
...
What is the motivation / use case for changing the behavior?
It should work as normal extends.
Environment
Nest version: ^8.0.0
@nestjs/mapped-types: ^1.0.0
For Tooling issues:
- Node version: v14.16.1
- Platform: Mac
Others:
The text was updated successfully, but these errors were encountered:
I'm submitting a...
Current behavior
When extends using OmitType(), the derived class does not contain Base class methods.
Expected behavior
Expect derived class to have parent class methods
Minimal reproduction of the problem with instructions
expect this code to log
this is a method
but it will throw the following error:What is the motivation / use case for changing the behavior?
It should work as normal
extends
.Environment
The text was updated successfully, but these errors were encountered: