Comments (6)
Fixed in v2.0.1
Thank you so much, really a big fan of your work! LEGAND
from mapped-types.
I believe it should be an easy fix from the team
it could be if someone provide us some code or the steps to create a repro of such issue, at least 😸
from mapped-types.
import { PartialType } from '@nestjs/mapped-types';
import {
IsBoolean,
IsEmpty,
IsOptional,
IsString,
} from 'class-validator';
export class SpCreateSpecializationDto {
@IsString()
name: string;
@IsString()
description?: string;
@IsOptional()
@IsBoolean()
isPublished?: boolean;
}
export class SpUpdateSpecializationDto extends PartialType(
SpCreateSpecializationDto,
) {
@IsEmpty()
isPublished?: boolean;
}
I found it can be fixed by using omit
, like this:
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>'.
I hope this is helpful.
from mapped-types.
Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
from mapped-types.
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.
from mapped-types.
Fixed in v2.0.1
from mapped-types.
Related Issues (20)
- PartialType and IntersectionType doesn't work as expected HOT 9
- Extending using PartialType, OmitType… doesn't copy properties decorators HOT 3
- PickType ignore parent's @Transform when grandparent use @Transform
- Breaking change in 2.0.3 for override fields HOT 5
- Using a PartialType inside a PickType will result in a type error. HOT 1
- IntersectionType breaks returning value of methods HOT 4
- `PickType` doesn't carry over property level`@Expose` decorators
- `RemoveFieldsWithType`: `Omit` instead of `Exclude`? HOT 1
- class-transformer doesn't exist HOT 1
- Can't inherit getter/setter and function HOT 2
- PartialType can't work with class-validator HOT 1
- `IntersectionType` clause for more than 4 classes is not available in the npm version HOT 4
- Remove @nestjs/common dependency HOT 2
- Could not resolve dependency: peerOptional class-validator@"^0.11.1 || ^0.12.0 || ^0.13.0" from @nestjs/[email protected] HOT 5
- Support for class-validator 0.14.0 HOT 4
- Install fails when class-validtor 0.14.0 already installed HOT 1
- Update security dependencies HOT 4
- `prettier/@typescript-eslint` in ESLint config now throws error HOT 1
- Update the class-validator dependency to 0.14.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapped-types.