diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 3ba4989..2f18ab6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,6 +3,8 @@ on: push: branches: - main + - chore/jsr + jobs: publish: @@ -15,26 +17,25 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '20' - registry-url: 'https://registry.npmjs.org' + # - name: Set up Node.js + # uses: actions/setup-node@v2 + # with: + # node-version: '20' + # registry-url: 'https://registry.npmjs.org' - - name: Install corepack - run: npm install -g corepack && corepack enable + # - name: Install corepack + # run: npm install -g corepack && corepack enable - - name: Install dependencies - run: pnpm install + # - name: Install dependencies + # run: pnpm install - - name: Build and test - run: pnpm build && pnpm test + # - name: Build and test + # run: pnpm build && pnpm test - - name: Publish package - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - # - name: Publish package on JSR - # run: pnpm dlx jsr publish + # - name: Publish package + # run: npm publish --access public + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish package on JSR + run: npx jsr publish diff --git a/BUILD_SHA b/BUILD_SHA deleted file mode 100644 index 29da5ff..0000000 --- a/BUILD_SHA +++ /dev/null @@ -1 +0,0 @@ -c946b99524d990734f842cc5c740c303bdf7b631 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a670917 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2019 Giorgio Delgado + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/jsr.json b/jsr.json index 64e982a..4ff01d2 100644 --- a/jsr.json +++ b/jsr.json @@ -1,5 +1,13 @@ { "name": "@inaiat/resultar", - "version": "1.1.2", - "exports": "./src/index.ts" + "version": "1.3.1", + "license": "MIT", + "exports": "./src/index.ts", + "publish": { + "include": [ + "LICENSE", + "README.md", + "src/**/*.ts" + ] + } } diff --git a/package.json b/package.json index 6c3a2bb..6f67b66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "resultar", - "version": "1.3.0", + "version": "1.3.1", "description": "Result pattern for typescript", "type": "module", "packageManager": "pnpm@9.12.0", @@ -19,7 +19,7 @@ "dist" ], "scripts": { - "build": "tsup && git rev-parse HEAD > BUILD_SHA", + "build": "tsup", "format": "dprint fmt", "lint": "dprint check && eslint", "lint:fix": "dprint fmt && eslint --fix", @@ -53,7 +53,7 @@ "devDependencies": { "@types/node": "^22.7.4", "dprint": "0.47.2", - "eslint": "^9.11.1", + "eslint": "^9.12.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-n": "^17.10.3", "eslint-plugin-unicorn": "^56.0.0", @@ -63,7 +63,7 @@ "testdouble": "^3.20.2", "tsup": "^8.3.0", "tsx": "^4.19.1", - "typedoc": "^0.26.7", + "typedoc": "^0.26.8", "typedoc-github-wiki-theme": "2.0.0", "typedoc-plugin-markdown": "^4.2.9", "typescript": "^5.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4bbd7cb..6ebcb29 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,20 +15,20 @@ importers: specifier: 0.47.2 version: 0.47.2 eslint: - specifier: ^9.11.1 - version: 9.11.1 + specifier: ^9.12.0 + version: 9.12.0 eslint-plugin-import: specifier: ^2.31.0 - version: 2.31.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1) + version: 2.31.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0) eslint-plugin-n: specifier: ^17.10.3 - version: 17.10.3(eslint@9.11.1) + version: 17.10.3(eslint@9.12.0) eslint-plugin-unicorn: specifier: ^56.0.0 - version: 56.0.0(eslint@9.11.1) + version: 56.0.0(eslint@9.12.0) eslint-plugin-unused-imports: specifier: ^4.1.4 - version: 4.1.4(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1) + version: 4.1.4(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0) husky: specifier: ^9.1.6 version: 9.1.6 @@ -45,20 +45,20 @@ importers: specifier: ^4.19.1 version: 4.19.1 typedoc: - specifier: ^0.26.7 - version: 0.26.7(typescript@5.6.2) + specifier: ^0.26.8 + version: 0.26.8(typescript@5.6.2) typedoc-github-wiki-theme: specifier: 2.0.0 - version: 2.0.0(typedoc-plugin-markdown@4.2.9(typedoc@0.26.7(typescript@5.6.2))) + version: 2.0.0(typedoc-plugin-markdown@4.2.9(typedoc@0.26.8(typescript@5.6.2))) typedoc-plugin-markdown: specifier: ^4.2.9 - version: 4.2.9(typedoc@0.26.7(typescript@5.6.2)) + version: 4.2.9(typedoc@0.26.8(typescript@5.6.2)) typescript: specifier: ^5.6.2 version: 5.6.2 typescript-eslint: specifier: ^8.8.0 - version: 8.8.0(eslint@9.11.1)(typescript@5.6.2) + version: 8.8.0(eslint@9.12.0)(typescript@5.6.2) packages: @@ -280,8 +280,8 @@ packages: resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.11.1': - resolution: {integrity: sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA==} + '@eslint/js@9.12.0': + resolution: {integrity: sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -292,12 +292,20 @@ packages: resolution: {integrity: sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@humanfs/core@0.19.0': + resolution: {integrity: sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.5': + resolution: {integrity: sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/retry@0.3.0': - resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} engines: {node: '>=18.18'} '@isaacs/cliui@8.0.2': @@ -893,20 +901,20 @@ packages: '@typescript-eslint/eslint-plugin': optional: true - eslint-scope@8.0.2: - resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} + eslint-scope@8.1.0: + resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - eslint-visitor-keys@4.0.0: - resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + eslint-visitor-keys@4.1.0: + resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.11.1: - resolution: {integrity: sha512-MobhYKIoAO1s1e4VUrgx1l1Sk2JBR/Gqjjgw8+mfgoLE2xwsHur4gdfTxyTgShrhvdVFTaJSgMiQBl1jv/AWxg==} + eslint@9.12.0: + resolution: {integrity: sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -915,8 +923,8 @@ packages: jiti: optional: true - espree@10.1.0: - resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} + espree@10.2.0: + resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} esquery@1.6.0: @@ -1193,10 +1201,6 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - is-plain-obj@1.1.0: resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} engines: {node: '>=0.10.0'} @@ -1858,8 +1862,8 @@ packages: peerDependencies: typedoc: 0.26.x - typedoc@0.26.7: - resolution: {integrity: sha512-gUeI/Wk99vjXXMi8kanwzyhmeFEGv1LTdTQsiyIsmSYsBebvFxhbcyAx7Zjo4cMbpLGxM4Uz3jVIjksu/I2v6Q==} + typedoc@0.26.8: + resolution: {integrity: sha512-QBF0BMbnNeUc6U7pRHY7Jb8pjhmiNWZNQT8LU6uk9qP9t3goP9bJptdlNqMC0wBB2w9sQrxjZt835bpRSSq1LA==} engines: {node: '>= 18'} hasBin: true peerDependencies: @@ -2075,9 +2079,9 @@ snapshots: '@esbuild/win32-x64@0.23.1': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1)': + '@eslint-community/eslint-utils@4.4.0(eslint@9.12.0)': dependencies: - eslint: 9.11.1 + eslint: 9.12.0 eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.0': {} @@ -2096,7 +2100,7 @@ snapshots: dependencies: ajv: 6.12.6 debug: 4.3.6 - espree: 10.1.0 + espree: 10.2.0 globals: 14.0.0 ignore: 5.3.2 import-fresh: 3.3.0 @@ -2106,7 +2110,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.11.1': {} + '@eslint/js@9.12.0': {} '@eslint/object-schema@2.1.4': {} @@ -2114,9 +2118,16 @@ snapshots: dependencies: levn: 0.4.1 + '@humanfs/core@0.19.0': {} + + '@humanfs/node@0.16.5': + dependencies: + '@humanfs/core': 0.19.0 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/retry@0.3.0': {} + '@humanwhocodes/retry@0.3.1': {} '@isaacs/cliui@8.0.2': dependencies: @@ -2260,15 +2271,15 @@ snapshots: '@types/unist@3.0.3': {} - '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/scope-manager': 8.8.0 - '@typescript-eslint/type-utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/type-utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 - eslint: 9.11.1 + eslint: 9.12.0 graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -2278,14 +2289,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) '@typescript-eslint/visitor-keys': 8.8.0 debug: 4.3.6 - eslint: 9.11.1 + eslint: 9.12.0 optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -2296,10 +2307,10 @@ snapshots: '@typescript-eslint/types': 8.8.0 '@typescript-eslint/visitor-keys': 8.8.0 - '@typescript-eslint/type-utils@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/type-utils@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: @@ -2325,13 +2336,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.8.0(eslint@9.11.1)(typescript@5.6.2)': + '@typescript-eslint/utils@8.8.0(eslint@9.12.0)(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@typescript-eslint/scope-manager': 8.8.0 '@typescript-eslint/types': 8.8.0 '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.6.2) - eslint: 9.11.1 + eslint: 9.12.0 transitivePeerDependencies: - supports-color - typescript @@ -2729,9 +2740,9 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-compat-utils@0.5.1(eslint@9.11.1): + eslint-compat-utils@0.5.1(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 semver: 7.6.3 eslint-import-resolver-node@0.3.9: @@ -2742,24 +2753,24 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.12.0): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - eslint: 9.11.1 + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + eslint: 9.12.0 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-es-x@7.8.0(eslint@9.11.1): + eslint-plugin-es-x@7.8.0(eslint@9.12.0): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@eslint-community/regexpp': 4.11.0 - eslint: 9.11.1 - eslint-compat-utils: 0.5.1(eslint@9.11.1) + eslint: 9.12.0 + eslint-compat-utils: 0.5.1(eslint@9.12.0) - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -2768,9 +2779,9 @@ snapshots: array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 9.11.1 + eslint: 9.12.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.11.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint@9.12.0) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -2782,32 +2793,32 @@ snapshots: string.prototype.trimend: 1.0.8 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color - eslint-plugin-n@17.10.3(eslint@9.11.1): + eslint-plugin-n@17.10.3(eslint@9.12.0): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) enhanced-resolve: 5.17.1 - eslint: 9.11.1 - eslint-plugin-es-x: 7.8.0(eslint@9.11.1) + eslint: 9.12.0 + eslint-plugin-es-x: 7.8.0(eslint@9.12.0) get-tsconfig: 4.7.6 globals: 15.9.0 ignore: 5.3.2 minimatch: 9.0.5 semver: 7.6.3 - eslint-plugin-unicorn@56.0.0(eslint@9.11.1): + eslint-plugin-unicorn@56.0.0(eslint@9.12.0): dependencies: '@babel/helper-validator-identifier': 7.24.7 - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) ci-info: 4.0.0 clean-regexp: 1.0.0 core-js-compat: 3.38.1 - eslint: 9.11.1 + eslint: 9.12.0 esquery: 1.6.0 globals: 15.9.0 indent-string: 4.0.0 @@ -2820,33 +2831,33 @@ snapshots: semver: 7.6.3 strip-indent: 3.0.0 - eslint-plugin-unused-imports@4.1.4(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1): + eslint-plugin-unused-imports@4.1.4(@typescript-eslint/eslint-plugin@8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0): dependencies: - eslint: 9.11.1 + eslint: 9.12.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) - eslint-scope@8.0.2: + eslint-scope@8.1.0: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 eslint-visitor-keys@3.4.3: {} - eslint-visitor-keys@4.0.0: {} + eslint-visitor-keys@4.1.0: {} - eslint@9.11.1: + eslint@9.12.0: dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.12.0) '@eslint-community/regexpp': 4.11.0 '@eslint/config-array': 0.18.0 '@eslint/core': 0.6.0 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.11.1 + '@eslint/js': 9.12.0 '@eslint/plugin-kit': 0.2.0 + '@humanfs/node': 0.16.5 '@humanwhocodes/module-importer': 1.0.1 - '@humanwhocodes/retry': 0.3.0 - '@nodelib/fs.walk': 1.2.8 + '@humanwhocodes/retry': 0.3.1 '@types/estree': 1.0.6 '@types/json-schema': 7.0.15 ajv: 6.12.6 @@ -2854,9 +2865,9 @@ snapshots: cross-spawn: 7.0.3 debug: 4.3.6 escape-string-regexp: 4.0.0 - eslint-scope: 8.0.2 - eslint-visitor-keys: 4.0.0 - espree: 10.1.0 + eslint-scope: 8.1.0 + eslint-visitor-keys: 4.1.0 + espree: 10.2.0 esquery: 1.6.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 @@ -2866,22 +2877,20 @@ snapshots: ignore: 5.3.2 imurmurhash: 0.1.4 is-glob: 4.0.3 - is-path-inside: 3.0.3 json-stable-stringify-without-jsonify: 1.0.1 lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 optionator: 0.9.4 - strip-ansi: 6.0.1 text-table: 0.2.0 transitivePeerDependencies: - supports-color - espree@10.1.0: + espree@10.2.0: dependencies: acorn: 8.12.1 acorn-jsx: 5.3.2(acorn@8.12.1) - eslint-visitor-keys: 4.0.0 + eslint-visitor-keys: 4.1.0 esquery@1.6.0: dependencies: @@ -3154,8 +3163,6 @@ snapshots: is-number@7.0.0: {} - is-path-inside@3.0.3: {} - is-plain-obj@1.1.0: {} is-regex@1.1.4: @@ -3831,15 +3838,15 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - typedoc-github-wiki-theme@2.0.0(typedoc-plugin-markdown@4.2.9(typedoc@0.26.7(typescript@5.6.2))): + typedoc-github-wiki-theme@2.0.0(typedoc-plugin-markdown@4.2.9(typedoc@0.26.8(typescript@5.6.2))): dependencies: - typedoc-plugin-markdown: 4.2.9(typedoc@0.26.7(typescript@5.6.2)) + typedoc-plugin-markdown: 4.2.9(typedoc@0.26.8(typescript@5.6.2)) - typedoc-plugin-markdown@4.2.9(typedoc@0.26.7(typescript@5.6.2)): + typedoc-plugin-markdown@4.2.9(typedoc@0.26.8(typescript@5.6.2)): dependencies: - typedoc: 0.26.7(typescript@5.6.2) + typedoc: 0.26.8(typescript@5.6.2) - typedoc@0.26.7(typescript@5.6.2): + typedoc@0.26.8(typescript@5.6.2): dependencies: lunr: 2.3.9 markdown-it: 14.1.0 @@ -3848,11 +3855,11 @@ snapshots: typescript: 5.6.2 yaml: 2.5.1 - typescript-eslint@8.8.0(eslint@9.11.1)(typescript@5.6.2): + typescript-eslint@8.8.0(eslint@9.12.0)(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.11.1)(typescript@5.6.2))(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/parser': 8.8.0(eslint@9.11.1)(typescript@5.6.2) - '@typescript-eslint/utils': 8.8.0(eslint@9.11.1)(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.8.0(@typescript-eslint/parser@8.8.0(eslint@9.12.0)(typescript@5.6.2))(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/parser': 8.8.0(eslint@9.12.0)(typescript@5.6.2) + '@typescript-eslint/utils': 8.8.0(eslint@9.12.0)(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: diff --git a/src/result-async.ts b/src/result-async.ts index c137204..8357516 100644 --- a/src/result-async.ts +++ b/src/result-async.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/unbound-method */ import type { Combine, Dedup, EmptyArrayToNever, IsLiteralArray, MemberListOf, MembersToUnion } from './result.js' import { Result } from './result.js' import type { @@ -204,7 +205,11 @@ export class ResultAsync implements PromiseLike> { ) } - if(fCondition: (t: T) => boolean) { + if(fCondition: (t: T) => boolean): { + true: (fTrue: (t: T) => ResultAsync) => { + false: (fFalse: (t: T) => ResultAsync) => ResultAsync + } + } { return { true: (fTrue: (t: T) => ResultAsync) => ({ false: (fFalse: (t: T) => ResultAsync): ResultAsync => @@ -364,9 +369,11 @@ export function safeTryAsync( ) } -// eslint-disable-next-line @typescript-eslint/unbound-method -export const { okAsync, errAsync, fromPromise, fromSafePromise, unitAsync } = ResultAsync -// eslint-disable-next-line @typescript-eslint/unbound-method +export const okAsync = ResultAsync.okAsync +export const errAsync = ResultAsync.errAsync +export const fromPromise = ResultAsync.fromPromise +export const fromSafePromise = ResultAsync.fromSafePromise +export const unitAsync = ResultAsync.unitAsync export const fromThrowableAsync = ResultAsync.fromThrowable // Combines the array of async results into one result. diff --git a/src/result.ts b/src/result.ts index 97d3d3c..adfd606 100644 --- a/src/result.ts +++ b/src/result.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/unbound-method */ import type { ErrorConfig } from './error.js' import { createResultarError } from './error.js' import { errAsync, ResultAsync } from './result-async.js' @@ -231,7 +232,11 @@ export class Result implements Resultable { return err(this.error) } - if(fCondition: (t: T) => boolean) { + if(fCondition: (t: T) => boolean): { + true: (fTrue: (t: T) => Result) => { + false: (fFalse: (t: T) => Result) => Result + } + } { return { true: (fTrue: (t: T) => Result) => ({ false: (fFalse: (t: T) => Result): Result => { @@ -542,8 +547,10 @@ export function safeTry( return n.value } -// eslint-disable-next-line @typescript-eslint/unbound-method -export const { ok, err, fromThrowable, unit } = Result +export const ok = Result.ok +export const err = Result.err +export const fromThrowable = Result.fromThrowable +export const unit = Result.unit // #region Combine - Types