Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: boolean-string converted to string #908

Merged

Conversation

0xthierry
Copy link
Contributor

Issue

The BooleanString converted value is a string instead of a boolean. This occurs because Typebox converts the value to the first matching schema, as shown here:

function FromUnion(schema: TUnion, references: TSchema[], value: any): unknown {
  for (const subschema of schema.anyOf) {
    const converted = Visit(subschema, references, value)
    if (!Check(subschema, references, converted)) continue
    return converted
  }
  return value
}

@sofyanox12
Copy link

Just realized this. Very straightforward and should've been merged.

@SaltyAom SaltyAom merged commit 7d94a7a into elysiajs:main Nov 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants