effect-io-ai

Package: effect
Module: Function

Function.absurd

Marks an impossible branch by accepting a never value and returning any type.

When to use

Use when you need a return value in a branch that exhaustive checks prove cannot be reached.

Gotchas

Calling absurd throws, because a value of type never should be impossible at runtime.

Example (Handling impossible values)

import { absurd } from "effect"

const handleNever = (value: never) => {
  return absurd(value) // This will throw an error if called
}

Signature

declare const absurd: <A>(_: never) => A

Source

Since v2.0.0