Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions migration/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,11 @@ import { Effect, Number, Option, Schema, SchemaGetter, SchemaIssue } from "effec
const NumberFromString = Schema.String.pipe(
Schema.decodeTo(Schema.Number, {
decode: SchemaGetter.transformOrFail((s) => {
const n = Number.parse(s)
if (n === undefined) {
const parsed = parseFloat(s)
if (isNaN(parsed)) {
Comment thread
danielo515 marked this conversation as resolved.
return Effect.fail(new SchemaIssue.InvalidValue(Option.some(s)))
}
return Effect.succeed(n)
return Effect.succeed(parsed)
}),
encode: SchemaGetter.String()
})
Expand Down
Loading