Type Alias $Error<M, T>

$Error: M extends any ? $Type<"error", { message: M; type: T }> : never

🧰 type util

A type-level error.

This is analogous to the Error class in JavaScript.

It can be used in type-level programming to represent an error with a message.

Type Parameters

  • M extends string
  • T = unknown
type T = $Error<'error message'>
type T = $Error<'error message', number>

8.0.0