t3-code-android-nightly/.repos/effect-smol/packages/tools/bundle/fixtures/schema-string-transformation.ts
Julius Marminge e3c85ead63
chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-17 23:21:25 -07:00

20 lines
568 B
TypeScript

import * as Duration from "effect/Duration"
import * as Effect from "effect/Effect"
import * as Schema from "effect/Schema"
import * as SchemaTransformation from "effect/SchemaTransformation"
const schema = Schema.String.pipe(Schema.decodeTo(
Schema.String,
SchemaTransformation.transformEffect({
decode: (s) =>
Effect.gen(function*() {
yield* Effect.clockWith((clock) => clock.sleep(Duration.millis(300)))
return s
}),
encode: (_) => Effect.succeed(_)
})
))
Schema.decodeUnknownEffect(schema)("a").pipe(
Effect.runFork
)