On this page
DocumentationStart

Quickstart

Install

Run bun add taxkit effect@4.0.7 in your TypeScript project. Taxkit uses native Effect values in both its plain and Effect interfaces.

Calculate take-home pay

Construct a checked scenario for the selected calculator. Amounts use exact decimal-dollar text; the scenario requires a non-negative amount and one period.

TypeScript
import { calculateSafe } from "taxkit";
import { AuPayTakeHomeCalculation } from "taxkit/au";
import { TakeHomeScenarioInputSchema } from "taxkit/au/schemas";
import { fromDecimal, nonNegative } from "taxkit/money";
import { Result } from "effect";

const input = Result.gen(function* () {
  const grossPay = yield* fromDecimal("1654.00").pipe(
    Result.flatMap(nonNegative)
  );
  return TakeHomeScenarioInputSchema.make({
    grossPay,
    period: "weekly",
    taxFreeThresholdClaimed: true,
  });
});
if (Result.isSuccess(input)) {
  const result = await calculateSafe(AuPayTakeHomeCalculation, input.success);
  if (Result.isSuccess(result)) {
    result.success.netPay.cents;
  } else {
    result.failure._tag;
  }
}

Read the result

This example returns 130100 net cents: AUD 1,301.00. A successful native Result contains success; a failed Result contains failure. The selected definition infers the pay report, so annual-tax fields produce a TypeScript error.

Money stays in safe integer cents. Use format from taxkit/money for decimal text, and use explicit decodeInput before execution when input is untrusted.

Next steps

See Plain SDK, Effect SDK and Type safety.