Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Mar 1, 2024
1 parent 6fcb94c commit 3239cda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/structs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ export function union<First extends AnyStruct, Rest extends AnyStruct[]>(
type: 'union',
schema: null,
coercer(value) {
for (const { validate } of Structs) {
const [error, coerced] = validate(value, { coerce: true });
for (const InnerStruct of Structs) {
const [error, coerced] = InnerStruct.validate(value, { coerce: true });
if (!error) {
return coerced;
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ export function* run<Type, Schema>(
yield [failure, undefined];
}

for (const [innerKey, innerValue, innerStruct] of struct.entries(
// eslint-disable-next-line prefer-const
for (let [innerKey, innerValue, innerStruct] of struct.entries(
value,
context,
)) {
Expand All @@ -220,8 +221,7 @@ export function* run<Type, Schema>(

yield [result[0], undefined];
} else if (coerce) {
// eslint-disable-next-line no-param-reassign
value = result[1];
innerValue = result[1];

if (innerKey === undefined) {
// eslint-disable-next-line no-param-reassign
Expand Down

0 comments on commit 3239cda

Please sign in to comment.