smart-result 0.0.1 → 0.0.3
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 +5 -5
- package/{src/index.ts → dist/index.d.ts} +4 -4
- package/package.json +7 -4
- package/CHANGELOG.md +0 -2
- package/tsconfig.json +0 -14
package/README.md
CHANGED
|
@@ -30,11 +30,11 @@ async function example() {
|
|
|
30
30
|
|
|
31
31
|
## Highlight
|
|
32
32
|
|
|
33
|
-
🖊 Good coding quality
|
|
34
|
-
👀 Highly readable
|
|
35
|
-
😄 Fewer things to remember
|
|
36
|
-
✅ Safety design
|
|
37
|
-
🛡 Type only
|
|
33
|
+
- 🖊 Good coding quality
|
|
34
|
+
- 👀 Highly readable
|
|
35
|
+
- 😄 Fewer things to remember
|
|
36
|
+
- ✅ Safety design
|
|
37
|
+
- 🛡 Type only
|
|
38
38
|
|
|
39
39
|
## Intall
|
|
40
40
|
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type OkResult<Data extends true | Record<string, any>> = {
|
|
7
7
|
readonly error?: never;
|
|
8
|
-
// If the result is `{}`, set it to `Record<string, unknown>` to make type resolution work as expected when the result branches.
|
|
9
8
|
readonly ok: [keyof Data] extends [never] ? Record<string, unknown> : Data;
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* Type of the result in case of error.
|
|
14
12
|
*/
|
|
15
|
-
export type ErrorResult<Error extends Record<string, any>> = {
|
|
16
|
-
|
|
13
|
+
export type ErrorResult<Error extends Record<string, any>> = {
|
|
14
|
+
readonly error: Error;
|
|
15
|
+
readonly ok?: never;
|
|
16
|
+
};
|
|
17
17
|
/**
|
|
18
18
|
* Object type for easier handling of results.
|
|
19
19
|
*
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-result",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn clean && tsc -p ./tsconfig.json",
|
|
7
|
-
"clean": "del-cli
|
|
7
|
+
"clean": "del-cli dist module",
|
|
8
8
|
"versionup:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major",
|
|
9
9
|
"versionup:minor": "changelog -m && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version minor",
|
|
10
10
|
"versionup:patch": "changelog -p && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version patch"
|
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
"url": "https://github.com/misuken-now/smart-result/issues"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/misuken-now/smart-result#readme",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"typings": "./dist/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"!**/__tests__"
|
|
27
|
+
],
|
|
25
28
|
"devDependencies": {
|
|
26
29
|
"generate-changelog": "^1.8.0",
|
|
27
30
|
"del-cli": "^4.0.1",
|
package/CHANGELOG.md
DELETED
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"outDir": "./lib",
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"skipLibCheck": true
|
|
11
|
-
},
|
|
12
|
-
"include": ["src/**/*.ts"],
|
|
13
|
-
"exclude": ["node_modules"]
|
|
14
|
-
}
|