Skip to content

Commit

Permalink
Merge pull request #926 from genki/set_typed_non_optional
Browse files Browse the repository at this point in the history
Set `typed` = true when the wrapped schema of nonOptional is typed
  • Loading branch information
fabian-hiller authored Nov 15, 2024
2 parents 644fd42 + 5288f7a commit f6c2ebc
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion library/src/methods/forward/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function forward<
const prevIssues = dataset.issues && [...dataset.issues];

// Run validation action
action['~run'](dataset, config);
dataset = action['~run'](dataset, config);

// If dataset contains issues, forward newly added issues
if (dataset.issues) {
Expand Down
2 changes: 1 addition & 1 deletion library/src/methods/forward/forwardAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function forwardAsync<
const prevIssues = dataset.issues && [...dataset.issues];

// Run validation action
await action['~run'](dataset, config);
dataset = await action['~run'](dataset, config);

// If dataset contains issues, forward newly added issues
if (dataset.issues) {
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonNullable/nonNullable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function nonNullable(
'~run'(dataset, config) {
// If value is not `null`, run wrapped schema
if (dataset.value !== null) {
this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = this.wrapped['~run'](dataset, config);
}

// If value is `null`, add issue to dataset
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonNullable/nonNullableAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export function nonNullableAsync(
async '~run'(dataset, config) {
// If value is not `null`, run wrapped schema
if (dataset.value !== null) {
await this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = await this.wrapped['~run'](dataset, config);
}

// If value is `null`, add issue to dataset
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonNullish/nonNullish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function nonNullish(
'~run'(dataset, config) {
// If value is not `null` and `undefined`, run wrapped schema
if (!(dataset.value === null || dataset.value === undefined)) {
this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = this.wrapped['~run'](dataset, config);
}

// If value is `null` or `undefined`, add issue to dataset
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonNullish/nonNullishAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export function nonNullishAsync(
async '~run'(dataset, config) {
// If value is not `null` and `undefined`, run wrapped schema
if (!(dataset.value === null || dataset.value === undefined)) {
await this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = await this.wrapped['~run'](dataset, config);
}

// If value is `null` or `undefined`, add issue to dataset
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonOptional/nonOptional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function nonOptional(
'~run'(dataset, config) {
// If value is not `undefined`, run wrapped schema
if (dataset.value !== undefined) {
this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = this.wrapped['~run'](dataset, config);
}

// If value is `undefined`, add issue to dataset
Expand Down
3 changes: 2 additions & 1 deletion library/src/schemas/nonOptional/nonOptionalAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export function nonOptionalAsync(
async '~run'(dataset, config) {
// If value is not `undefined`, run wrapped schema
if (dataset.value !== undefined) {
await this.wrapped['~run'](dataset, config);
// @ts-expect-error
dataset = await this.wrapped['~run'](dataset, config);
}

// If value is `undefined`, add issue to dataset
Expand Down

0 comments on commit f6c2ebc

Please sign in to comment.