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
Class 'CreateUserDto' incorrectly extends base class 'RemoveFieldsWithType<Partial<User>, Function>'. Property 'status' is optional in type 'CreateUserDto' but required in type 'RemoveFieldsWithType<Partial<User>, Function>'
#1121
Closed
2 of 4 tasks
praveendodda07 opened this issue
Jun 18, 2023
· 6 comments
install @nestjs/mapped-types with 2.0.0 version
User "Partial" method from it.
Getting the error like: Class 'CreateUserDto' incorrectly extends base class 'RemoveFieldsWithType<Partial, Function>'.
Property 'status' is optional in type 'CreateUserDto' but required in type 'RemoveFieldsWithType<Partial, Function>'.
Expected behavior
This error should not come.
Package version
2.0.0
Node.js version
14.21.3
In which operating systems have you tested?
macOS
Windows
Linux
Other
No response
The text was updated successfully, but these errors were encountered:
Getting the same error after upgrading to Nest10 today. Amazing work on the release, great job!
Made a small workaround by using the working version of partialtype.helper in version 1.2.
I believe it should be an easy fix from the team. Looking forward to it.
The error is caused when using a partial type, and says that the rest of the data is required, although it's a partial type.
export class SpUpdateSpecializationDto extends PartialType(
OmitType(SpCreateSpecializationDto, ['isPublished'] as const),
) {
@IsEmpty()
isPublished?: undefined;
}
This removes the error of: Class 'SpUpdateSpecializationDto' incorrectly extends base class 'RemoveFieldsWithType<Partial<SpCreateSpecializationDto>, Function>'. Property 'courseIds' is optional in type 'SpUpdateSpecializationDto' but required in type 'RemoveFieldsWithType<Partial<SpCreateSpecializationDto>, Function>'.
Is there an existing issue for this?
Current behavior
In version 2.0.0 we are getting this error. user Partial
Minimum reproduction code
https://github.com/nestjs/mapped-types
Steps to reproduce
install @nestjs/mapped-types with 2.0.0 version
User "Partial" method from it.
Getting the error like: Class 'CreateUserDto' incorrectly extends base class 'RemoveFieldsWithType<Partial, Function>'.
Property 'status' is optional in type 'CreateUserDto' but required in type 'RemoveFieldsWithType<Partial, Function>'.
Expected behavior
This error should not come.
Package version
2.0.0
Node.js version
14.21.3
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: