Looking for Tools to Warn About Unhandled Errors in Effect Typescript

I'm working through some of the examples with a create-effect-app project and thought I might get some squigglies warning me that there's an unhandled error here that can crash the program (through an eslint plugin or the devtools extension or something else). Is there anything that provides this kind of checking?

import { Effect } from "effect"

const addServiceCharge = (amount: number) => amount + 1

const applyDiscount = (
  total: number,
  discountRate: number // The number that comes before the percent e.g. 0-400
): Effect.Effect<number, Error, never> =>
  discountRate === 0
    ? Effect.fail(new Error("discount rate cannot be zero"))
    : Effect.succeed(total - (total * discountRate) / 100)

const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))

const fetchDiscountRate = Effect.promise(() => Promise.resolve(5))

const program = Effect.gen(function*() {
  const transactionAmount = yield* fetchTransactionAmount
  const discountRate = yield* fetchDiscountRate
  const totalAfterDiscount = yield* applyDiscount(
    transactionAmount, //             ^ maybe some yellow squiggly that
                       //               prompts me to wrap with Effect.either
    discountRate
  )
  const finalTotal = addServiceCharge(totalAfterDiscount)
  return `Final total is ${finalTotal}`
})
Was this page helpful?