@finnair/v-validation
Advanced tools
Comparing version 7.0.0-alpha.2 to 7.0.0-alpha.3
@@ -6,2 +6,8 @@ # Change Log | ||
# [7.0.0-alpha.3](https://github.com/finnair/v-validation/compare/v7.0.0-alpha.2...v7.0.0-alpha.3) (2024-11-11) | ||
### Bug Fixes | ||
- objectType: infer optional properties for next and localNext ([3c41da9](https://github.com/finnair/v-validation/commit/3c41da9a3fd0f04f2de801736f2ceeaf46a0453e)) | ||
# [7.0.0-alpha.2](https://github.com/finnair/v-validation/compare/v7.0.0-alpha.1...v7.0.0-alpha.2) (2024-11-08) | ||
@@ -8,0 +14,0 @@ |
@@ -6,5 +6,5 @@ import { Validator } from "./validators.js"; | ||
}[keyof T]; | ||
type Optional<T> = Partial<Pick<T, KeysOfType<T, undefined>>>; | ||
type Required<T> = Omit<T, KeysOfType<T, undefined>>; | ||
type OptionalUndefined<T> = Optional<T> & Required<T>; | ||
type OptionalProperties<T> = Partial<Pick<T, KeysOfType<T, undefined>>>; | ||
type RequiredProperties<T> = Omit<T, KeysOfType<T, undefined>>; | ||
type UndefinedAsOptionalProperties<T> = RequiredProperties<T> & OptionalProperties<T>; | ||
export declare class ObjectValidatorBuilder<Props, Next, LocalProps, LocalNext> { | ||
@@ -21,6 +21,6 @@ private _extends; | ||
[K in keyof X]: Validator<X[K]>; | ||
}): ObjectValidatorBuilder<Props & X, Next, LocalProps, LocalNext>; | ||
}): ObjectValidatorBuilder<Props & UndefinedAsOptionalProperties<X>, Next, LocalProps, LocalNext>; | ||
localProperties<X>(localProperties: { | ||
[K in keyof X]: Validator<X[K]>; | ||
}): ObjectValidatorBuilder<Props, Next, LocalProps & X, LocalNext>; | ||
}): ObjectValidatorBuilder<Props, Next, LocalProps & UndefinedAsOptionalProperties<X>, LocalNext>; | ||
allowAdditionalProperties(allow: boolean): ObjectValidatorBuilder<Props & Record<string | number | symbol, unknown>, Next, LocalProps, LocalNext>; | ||
@@ -30,4 +30,4 @@ additionalProperties<K extends keyof any, V>(keys: Validator<K>, values: Validator<V>): ObjectValidatorBuilder<Props & Record<K, V>, Next, LocalProps, LocalNext>; | ||
localNext<NextOut>(validator: Validator<NextOut, LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps>): ObjectValidatorBuilder<Props, Next, LocalProps, NextOut>; | ||
build(): ObjectValidator<OptionalUndefined<LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps>, OptionalUndefined<Next extends {} ? Next : Props>>; | ||
build(): ObjectValidator<LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps, Next extends {} ? Next : Props>; | ||
} | ||
export {}; |
@@ -6,5 +6,5 @@ import { Validator } from "./validators.js"; | ||
}[keyof T]; | ||
type Optional<T> = Partial<Pick<T, KeysOfType<T, undefined>>>; | ||
type Required<T> = Omit<T, KeysOfType<T, undefined>>; | ||
type OptionalUndefined<T> = Optional<T> & Required<T>; | ||
type OptionalProperties<T> = Partial<Pick<T, KeysOfType<T, undefined>>>; | ||
type RequiredProperties<T> = Omit<T, KeysOfType<T, undefined>>; | ||
type UndefinedAsOptionalProperties<T> = RequiredProperties<T> & OptionalProperties<T>; | ||
export declare class ObjectValidatorBuilder<Props, Next, LocalProps, LocalNext> { | ||
@@ -21,6 +21,6 @@ private _extends; | ||
[K in keyof X]: Validator<X[K]>; | ||
}): ObjectValidatorBuilder<Props & X, Next, LocalProps, LocalNext>; | ||
}): ObjectValidatorBuilder<Props & UndefinedAsOptionalProperties<X>, Next, LocalProps, LocalNext>; | ||
localProperties<X>(localProperties: { | ||
[K in keyof X]: Validator<X[K]>; | ||
}): ObjectValidatorBuilder<Props, Next, LocalProps & X, LocalNext>; | ||
}): ObjectValidatorBuilder<Props, Next, LocalProps & UndefinedAsOptionalProperties<X>, LocalNext>; | ||
allowAdditionalProperties(allow: boolean): ObjectValidatorBuilder<Props & Record<string | number | symbol, unknown>, Next, LocalProps, LocalNext>; | ||
@@ -30,4 +30,4 @@ additionalProperties<K extends keyof any, V>(keys: Validator<K>, values: Validator<V>): ObjectValidatorBuilder<Props & Record<K, V>, Next, LocalProps, LocalNext>; | ||
localNext<NextOut>(validator: Validator<NextOut, LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps>): ObjectValidatorBuilder<Props, Next, LocalProps, NextOut>; | ||
build(): ObjectValidator<OptionalUndefined<LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps>, OptionalUndefined<Next extends {} ? Next : Props>>; | ||
build(): ObjectValidator<LocalNext extends {} ? LocalNext : Next extends {} ? Next : Props & LocalProps, Next extends {} ? Next : Props>; | ||
} | ||
export {}; |
{ | ||
"name": "@finnair/v-validation", | ||
"version": "7.0.0-alpha.2", | ||
"version": "7.0.0-alpha.3", | ||
"private": false, | ||
@@ -51,5 +51,5 @@ "description": "V-validation core package", | ||
"devDependencies": { | ||
"@finnair/path": "^7.0.0-alpha.2" | ||
"@finnair/path": "^7.0.0-alpha.3" | ||
}, | ||
"gitHead": "e5f44227e5c78c322a7874f665b122c5e5446acc" | ||
"gitHead": "6bb252ef025e936a14bc9f71e78804b61ea212e8" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302740