@mkvlrn/result 4.0.12 → 4.0.14
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/build/index.d.ts +2 -2
- package/build/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* It is also an alias object containing the ok and error functions to
|
|
7
7
|
* make it easier to create Result objects.
|
|
8
8
|
*/
|
|
9
|
-
export type Result<T, E extends Error> = {
|
|
9
|
+
export type Result<T, E extends Error = Error> = {
|
|
10
10
|
readonly error: undefined;
|
|
11
11
|
readonly value: T;
|
|
12
12
|
} | {
|
|
@@ -15,7 +15,7 @@ export type Result<T, E extends Error> = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Async version of Result type that wraps a Result in a Promise.
|
|
17
17
|
*/
|
|
18
|
-
export type AsyncResult<T, E extends Error> = Promise<Result<T, E>>;
|
|
18
|
+
export type AsyncResult<T, E extends Error = Error> = Promise<Result<T, E>>;
|
|
19
19
|
/**
|
|
20
20
|
* Result utility functions for creating Result objects.
|
|
21
21
|
*/
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Result type to represent the outcome of an operation.\n * It can either be a success with a value or an error.\n * This is a generic type that can be used with any type of value and error (should extend Error).\n *\n * It is also an alias object containing the ok and error functions to\n * make it easier to create Result objects.\n */\nexport type Result<T, E extends Error> =\n | { readonly error: undefined; readonly value: T }\n | { readonly error: E };\n\n/**\n * Async version of Result type that wraps a Result in a Promise.\n */\nexport type AsyncResult<T, E extends Error> = Promise<Result<T, E>>;\n\n/**\n * Result utility functions for creating Result objects.\n */\nexport const R: {\n /**\n * Creates a successful Result with the given value.\n * @param value The success value\n * @returns A Result object representing success\n */\n ok<T>(value: T): Result<T, never>;\n /**\n * Creates an error Result with the given error.\n * @param error The error value\n * @returns A Result object representing error\n */\n error<E extends Error>(error: E): Result<never, E>;\n} = {\n ok: <T>(value: T): Result<T, never> => ({ error: undefined, value }),\n error: <E extends Error>(error: E): Result<never, E> => ({ error }),\n};\n"],"names":["R","value","error"],"mappings":"AAoBO,MAAMA,IAaT;AAAA,EACF,IAAI,CAAIC,OAAgC,EAAE,OAAO,QAAW,OAAAA,EAAA;AAAA,EAC5D,OAAO,CAAkBC,OAAgC,EAAE,OAAAA,EAAA;AAC7D;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Result type to represent the outcome of an operation.\n * It can either be a success with a value or an error.\n * This is a generic type that can be used with any type of value and error (should extend Error).\n *\n * It is also an alias object containing the ok and error functions to\n * make it easier to create Result objects.\n */\nexport type Result<T, E extends Error = Error> =\n | { readonly error: undefined; readonly value: T }\n | { readonly error: E };\n\n/**\n * Async version of Result type that wraps a Result in a Promise.\n */\nexport type AsyncResult<T, E extends Error = Error> = Promise<Result<T, E>>;\n\n/**\n * Result utility functions for creating Result objects.\n */\nexport const R: {\n /**\n * Creates a successful Result with the given value.\n * @param value The success value\n * @returns A Result object representing success\n */\n ok<T>(value: T): Result<T, never>;\n /**\n * Creates an error Result with the given error.\n * @param error The error value\n * @returns A Result object representing error\n */\n error<E extends Error>(error: E): Result<never, E>;\n} = {\n ok: <T>(value: T): Result<T, never> => ({ error: undefined, value }),\n error: <E extends Error>(error: E): Result<never, E> => ({ error }),\n};\n"],"names":["R","value","error"],"mappings":"AAoBO,MAAMA,IAaT;AAAA,EACF,IAAI,CAAIC,OAAgC,EAAE,OAAO,QAAW,OAAAA,EAAA;AAAA,EAC5D,OAAO,CAAkBC,OAAgC,EAAE,OAAAA,EAAA;AAC7D;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkvlrn/result",
|
|
3
3
|
"description": "Simple Result type/pattern for TypeScript",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Mike Valeriano <mkvlrn@proton.me>",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"start": "node build/bundle.js",
|
|
31
31
|
"test": "vitest",
|
|
32
32
|
"biome-check": "biome check --no-errors-on-unmatched",
|
|
33
|
-
"biome-fix": "
|
|
33
|
+
"biome-fix": "yarn biome-check --write",
|
|
34
34
|
"typecheck": "tsc --noEmit",
|
|
35
35
|
"lint-staged": "lint-staged",
|
|
36
36
|
"prepare": "husky"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^24.
|
|
39
|
+
"@types/node": "^24.3.0",
|
|
40
40
|
"@vitest/coverage-v8": "^3.2.4",
|
|
41
|
-
"lint-staged": "^16.1.
|
|
42
|
-
"rollup-plugin-node-externals": "^8.0
|
|
41
|
+
"lint-staged": "^16.1.5",
|
|
42
|
+
"rollup-plugin-node-externals": "^8.1.0",
|
|
43
43
|
"tsc-files": "^1.1.4",
|
|
44
|
-
"tsx": "^4.20.
|
|
44
|
+
"tsx": "^4.20.5",
|
|
45
45
|
"typescript": "^5.9.2",
|
|
46
|
-
"vite": "^7.
|
|
46
|
+
"vite": "^7.1.3",
|
|
47
47
|
"vite-plugin-dts": "^4.5.4",
|
|
48
48
|
"vite-tsconfig-paths": "^5.1.4",
|
|
49
49
|
"vitest": "^3.2.4"
|