- Build:
pnpm build(Runstsdown) - Test (All):
pnpm test(Runsvitest run) - Test (Single):
pnpm test path/to/test.ts - Type Check:
pnpm typecheck(Runstsc --noEmit) - Lint & Format:
pnpm biome check .(orpnpm biome check --write .to fix)
- Strict TypeScript: The project uses strict TypeScript settings. Never use "any". Never use "as" casting unless it is absolutely necessary.
- Generators: Use
Effect.gen(function* () { ... })for effectful computations. - Piping: Use
.pipe()for chaining operations. - Error Handling:
- Use
Data.TaggedErrorfor custom errors (e.g.,class MyError extends Data.TaggedError("MyError")<{ ... }> {}). - Handle errors using
Effect.catchAllorEffect.catchTag.
- Use
- Layers & Services:
- Define services using
Context.Tag.
- Define services using
-
Use
@effect/vitestfor testing. -
Use
it.layer(Layer)(...)to provide context to tests. -
Use
it.effect(...)orit.scoped(...)for effectful tests. -
Use
assertfrom@effect/vitestfor assertions. -
Example:
import { it, assert } from "@effect/vitest"; import { Effect } from "effect"; it.effect( "should work", Effect.gen(function* () { // test logic assert.strictEqual(1, 1); }), );
The project uses a standard error handling pattern with Data.TaggedError:
export class LibreOfficeError extends Data.TaggedError("LibreOfficeError")<{
reason: Reason;
message: string;
cause?: unknown;
}> {}When handling errors, checking the reason field is common.