📦
unwrapit
  • 👋Welcome to unwrapit
  • Intro
    • 💡Why use it?
    • ✨Getting Started
  • APIs
    • 🔨wrap
    • 🔨unwrap
    • 🔨unwrapOr
    • 🔨unwrapOrElse
    • 🔨expect
    • 🔨mapErr
    • 🔨defineWrapConfig
    • 🔨ok
    • 🔨err
  • Type
    • 🔧Result
    • 🔧WrapConfig
    • 🔧WrapOption
    • 🔧Panic
  • Recipe
    • 🎨Export Wrapped Functions
    • 🎨Return Result Without `wrap` it
Powered by GitBook
On this page
  1. APIs

err

err is used to create an error Result type.

Usage

import {err} from 'unwrapit'

const v = err('error')
//    ^? Result<unknown, string>

You can specify the ok value type

const v = err<string, number>('error')
//    ^? Result<number, string>
PreviousokNextResult

Last updated 1 year ago

🔨