On this page
DocumentationSDK

Schemas

Import the owning codecs from taxkit/money, taxkit/au/schemas and taxkit/schemas. Schema.Type and Schema.Encoded stay distinct: a checked value carries validation evidence, while JSON is decoded at ingress.

TypeScript
import { Effect } from "effect";
import { AuPayTakeHomeCalculation } from "taxkit/au";
import { calculateReport, decodeInput } from "taxkit/effect";

// Decode the selected scenario once; surplus fields fail as well.
export const invalidInput = decodeInput(AuPayTakeHomeCalculation, {
  taxableIncome: { _tag: "Money", cents: 9_000_000, currency: "AUD" },
});
export const validInput = decodeInput(AuPayTakeHomeCalculation, {
  grossPay: { _tag: "Money", cents: 165_400, currency: "AUD" },
  period: "weekly",
  taxFreeThresholdClaimed: true,
}).pipe(
  Effect.flatMap((input) => calculateReport(AuPayTakeHomeCalculation, input))
);

Reports and ledgers check aggregate equations and unique component identities. Use the owner's explicit TakeHomePayReportEncoded codec for encoded-only validation; rebuilding a Struct from fields or extracting a bare encoded view can discard whole-record checks in Effect 4.0.7.

Derive form integration with Schema.toStandardSchemaV1 and JSON Schema with Schema.toJsonSchemaDocument and its matching JSON codec. Effect validation remains authoritative for relationships JSON Schema cannot express.