@hazae41/result
Advanced tools
Comparing version 1.1.16 to 1.2.0
export { Err } from './mods/result/err.js'; | ||
export { AssertError, Catched, Panic, Unimplemented } from './mods/result/errors.js'; | ||
export { Catched, Panic } from './mods/result/errors.js'; | ||
export { Ok } from './mods/result/ok.js'; | ||
export { Result, Unwrappable } from './mods/result/result.js'; |
@@ -1,18 +0,4 @@ | ||
import { Err } from './err.js'; | ||
declare class Unimplemented extends Error { | ||
#private; | ||
readonly name: string; | ||
constructor(options?: ErrorOptions); | ||
} | ||
declare class AssertError extends Error { | ||
#private; | ||
readonly name: string; | ||
constructor(options?: ErrorOptions); | ||
} | ||
declare class Panic extends Error { | ||
#private; | ||
readonly name: string; | ||
static from(cause: unknown): Panic; | ||
static fromAndThrow(cause: unknown): never; | ||
} | ||
@@ -22,14 +8,5 @@ declare class Catched extends Error { | ||
readonly name: string; | ||
constructor(options?: ErrorOptions); | ||
static from(cause: unknown): Catched; | ||
static fromAndThrow(cause: unknown): never; | ||
/** | ||
* Throw if `Catched`, wrap in `Err` otherwise | ||
* @param error | ||
* @returns `Err(error)` if not `Catched` | ||
* @throws `error.cause` if `Catched` | ||
*/ | ||
static throwOrErr(error: unknown): Err<unknown>; | ||
static wrap(cause: unknown): Error | Catched; | ||
} | ||
export { AssertError, Catched, Panic, Unimplemented }; | ||
export { Catched, Panic }; |
import { Nullable } from '@hazae41/option'; | ||
import { Awaitable } from '../../libs/promises/promises.js'; | ||
import { Err } from './err.js'; | ||
import { AssertError, Catched } from './errors.js'; | ||
import { Ok } from './ok.js'; | ||
@@ -25,3 +24,3 @@ | ||
*/ | ||
function assert(value: boolean): Ok<void> | Err<AssertError>; | ||
function assert(value: boolean): Ok<void> | Err<void>; | ||
/** | ||
@@ -80,3 +79,3 @@ * Rewrap any type that extends Ok into an Ok | ||
*/ | ||
function runAndDoubleWrap<T>(callback: () => Awaitable<T>): Promise<Result<T, Catched>>; | ||
function runAndDoubleWrap<T>(callback: () => Awaitable<T>): Promise<Result<T, Error>>; | ||
/** | ||
@@ -87,3 +86,3 @@ * Run a callback and wrap any returned value in Ok<T> and any thrown error in Err<Catched> | ||
*/ | ||
function runAndDoubleWrapSync<T>(callback: () => T): Result<T, Catched>; | ||
function runAndDoubleWrapSync<T>(callback: () => T): Result<T, Error>; | ||
/** | ||
@@ -106,3 +105,3 @@ * Run a callback and wrap any thrown error in Err<unknown> | ||
*/ | ||
function runOrDoubleWrap<R extends Result.Infer<R>>(callback: () => Awaitable<R>): Promise<R | Err<Catched>>; | ||
function runOrDoubleWrap<R extends Result.Infer<R>>(callback: () => Awaitable<R>): Promise<R | Err<Error>>; | ||
/** | ||
@@ -113,3 +112,3 @@ * Run a callback and wrap any thrown error in Err<unknown> | ||
*/ | ||
function runOrDoubleWrapSync<R extends Result.Infer<R>>(callback: () => R): R | Err<Catched>; | ||
function runOrDoubleWrapSync<R extends Result.Infer<R>>(callback: () => R): R | Err<Error>; | ||
/** | ||
@@ -116,0 +115,0 @@ * Transform `Iterable<Result<T,E>` into `Result<Array<T>, E>` |
{ | ||
"type": "module", | ||
"name": "@hazae41/result", | ||
"version": "1.1.16", | ||
"version": "1.2.0", | ||
"description": "Rust-like Result for TypeScript", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/result", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208666
3246