@firtoz/maybe-error 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  Type-safe result handling with the MaybeError pattern for TypeScript. Perfect for elegant error handling without exceptions.
8
8
 
9
+ > **⚠️ Early WIP Notice:** This package is in very early development and is **not production-ready**. It is TypeScript-only and may have breaking changes. While I (the maintainer) have limited time, I'm open to PRs for features, bug fixes, or additional support (like JS builds). Please feel free to try it out and contribute! See [CONTRIBUTING.md](../../CONTRIBUTING.md) for details.
10
+
9
11
  ## Features
10
12
 
11
13
  - ✅ **Type-safe error handling** - Full TypeScript support with discriminated unions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firtoz/maybe-error",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Type-safe result handling with MaybeError pattern",
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -50,6 +50,6 @@
50
50
  "access": "public"
51
51
  },
52
52
  "devDependencies": {
53
- "bun-types": "^1.3.0"
53
+ "bun-types": "^1.3.5"
54
54
  }
55
55
  }
package/src/MaybeError.ts CHANGED
@@ -107,12 +107,8 @@ export type MaybeError<T = undefined, TError = string> =
107
107
  * type UserType = AssumeSuccess<UserResult>; // User
108
108
  * ```
109
109
  */
110
- export type AssumeSuccess<T extends MaybeError<unknown>> = Exclude<
111
- T,
112
- undefined
113
- > extends MaybeError<infer U>
114
- ? U
115
- : never;
110
+ export type AssumeSuccess<T extends MaybeError<unknown>> =
111
+ Exclude<T, undefined> extends MaybeError<infer U> ? U : never;
116
112
 
117
113
  /**
118
114
  * Creates a successful result with an optional value.
@@ -0,0 +1,3 @@
1
+ export function exhaustiveGuard(value: never): never {
2
+ throw new Error(`Exhaustive guard triggered with value: ${value}`);
3
+ }
package/src/index.ts CHANGED
@@ -1 +1,9 @@
1
- export * from "./MaybeError";
1
+ export {
2
+ type MaybeError,
3
+ success,
4
+ fail,
5
+ type AssumeSuccess,
6
+ type DefiniteError,
7
+ type DefiniteSuccess,
8
+ } from "./MaybeError";
9
+ export { exhaustiveGuard } from "./exhaustiveGuard";