Effect CommunityEC
Effect Community2y ago
18 replies
youcef

Bug in TypeScript Code

this feels like a bug
import { Schema as S } from "@effect/schema";
import { Console, Effect, pipe } from "effect";
import { BunRuntime } from "@effect/platform-bun";

const nameSchema = S.Struct({
    name: S.String,
});

const program = pipe(
    Effect.succeed({
        name: "bob",
    }),
    S.decodeUnknown(nameSchema),
    Effect.tap((p) => Console.log(p)),
);

BunRuntime.runMain(program);

it errors with:
timestamp=2024-04-27T14:49:00.728Z level=ERROR fiber=#0 cause="{ name: string }
└─ [\"name\"]
   └─ is missing
Was this page helpful?