<T>(): TCreates a compile-time placeholder for a value of any type.
When to use
Use as a temporary typed placeholder while developing incomplete code.
Gotchas
hole is intended for temporary development use. If the placeholder is
evaluated at runtime, it throws.
Example (Creating a development placeholder)
import { hole } from "effect"
// Intentionally not called: `hole` throws if the placeholder is evaluated.
const buildUser = (id: number): { readonly id: number; readonly name: string } => ({
id,
name: hole<string>()
})
console.log(typeof buildUser) // "function"export const const hole: <T>() => TCreates a compile-time placeholder for a value of any type.
When to use
Use as a temporary typed placeholder while developing incomplete code.
Gotchas
hole is intended for temporary development use. If the placeholder is
evaluated at runtime, it throws.
Example (Creating a development placeholder)
import { hole } from "effect"
// Intentionally not called: `hole` throws if the placeholder is evaluated.
const buildUser = (id: number): { readonly id: number; readonly name: string } => ({
id,
name: hole<string>()
})
console.log(typeof buildUser) // "function"
hole: <function (type parameter) T in <T>(): TT>() => function (type parameter) T in <T>(): TT = const cast: <<A>(_: never) => A, <T>() => T>(a: <A>(_: never) => A) => <T>() => TReturns the input value with a different static type.
When to use
Use when you need an explicit type-level cast and accept that the value is
returned unchanged at runtime.
Gotchas
This is a type-level cast only; it performs no runtime validation or
conversion.
cast(const absurd: <A>(_: never) => AMarks 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
}
absurd)