@serkonda7/ts-result 1.0.5 → 1.0.6
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 +1 -1
- package/dist/src/result.d.ts +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ function parsePort (input: string): Result<number> {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (port < 1 || port > 65535) {
|
|
34
|
-
|
|
34
|
+
// It supports strings, Error classes or any custom object
|
|
35
35
|
return err(new Error('PORT must be between 1 and 65535'))
|
|
36
36
|
}
|
|
37
37
|
|
package/dist/src/result.d.ts
CHANGED
|
@@ -12,11 +12,10 @@ type Err<E> = {
|
|
|
12
12
|
error: E;
|
|
13
13
|
value?: never;
|
|
14
14
|
};
|
|
15
|
-
type ErrorTypes = string | Error;
|
|
16
15
|
/**
|
|
17
16
|
* Union type representing either success or failure.
|
|
18
17
|
*/
|
|
19
|
-
export type Result<V, E =
|
|
18
|
+
export type Result<V, E = Error> = Ok<V> | Err<E>;
|
|
20
19
|
/**
|
|
21
20
|
* Helper to create a successful Result.
|
|
22
21
|
*/
|
|
@@ -24,7 +23,7 @@ export declare const ok: <V>(value: V) => Ok<V>;
|
|
|
24
23
|
/**
|
|
25
24
|
* Helper to create a failed Result.
|
|
26
25
|
*/
|
|
27
|
-
export declare const err: <E
|
|
26
|
+
export declare const err: <E>(error: E) => Err<E>;
|
|
28
27
|
/**
|
|
29
28
|
* Returns the `value` from a Result.
|
|
30
29
|
*
|
package/package.json
CHANGED