feat: Improve options type (#291)

* feat: improve options type

* chore: dependencies version
This commit is contained in:
MARCROCK22 2024-11-06 01:21:36 -04:00 committed by GitHub
parent 4f546b3ffc
commit fb26e0e42e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 183 additions and 143 deletions

View File

@ -24,7 +24,7 @@
"@biomejs/biome": "1.9.4",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@types/node": "^22.8.6",
"@types/node": "^22.9.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"typescript": "^5.6.3",

202
pnpm-lock.yaml generated
View File

@ -13,13 +13,13 @@ importers:
version: 1.9.4
'@commitlint/cli':
specifier: ^19.5.0
version: 19.5.0(@types/node@22.8.6)(typescript@5.6.3)
version: 19.5.0(@types/node@22.9.0)(typescript@5.6.3)
'@commitlint/config-conventional':
specifier: ^19.5.0
version: 19.5.0
'@types/node':
specifier: ^22.8.6
version: 22.8.6
specifier: ^22.9.0
version: 22.9.0
husky:
specifier: ^9.1.6
version: 9.1.6
@ -31,7 +31,7 @@ importers:
version: 5.6.3
vitest:
specifier: ^2.1.4
version: 2.1.4(@types/node@22.8.6)
version: 2.1.4(@types/node@22.9.0)
packages:
@ -306,93 +306,93 @@ packages:
'@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
'@rollup/rollup-android-arm-eabi@4.24.3':
resolution: {integrity: sha512-ufb2CH2KfBWPJok95frEZZ82LtDl0A6QKTa8MoM+cWwDZvVGl5/jNb79pIhRvAalUu+7LD91VYR0nwRD799HkQ==}
'@rollup/rollup-android-arm-eabi@4.24.4':
resolution: {integrity: sha512-jfUJrFct/hTA0XDM5p/htWKoNNTbDLY0KRwEt6pyOA6k2fmk0WVwl65PdUdJZgzGEHWx+49LilkcSaumQRyNQw==}
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm64@4.24.3':
resolution: {integrity: sha512-iAHpft/eQk9vkWIV5t22V77d90CRofgR2006UiCjHcHJFVI1E0oBkQIAbz+pLtthFw3hWEmVB4ilxGyBf48i2Q==}
'@rollup/rollup-android-arm64@4.24.4':
resolution: {integrity: sha512-j4nrEO6nHU1nZUuCfRKoCcvh7PIywQPUCBa2UsootTHvTHIoIu2BzueInGJhhvQO/2FTRdNYpf63xsgEqH9IhA==}
cpu: [arm64]
os: [android]
'@rollup/rollup-darwin-arm64@4.24.3':
resolution: {integrity: sha512-QPW2YmkWLlvqmOa2OwrfqLJqkHm7kJCIMq9kOz40Zo9Ipi40kf9ONG5Sz76zszrmIZZ4hgRIkez69YnTHgEz1w==}
'@rollup/rollup-darwin-arm64@4.24.4':
resolution: {integrity: sha512-GmU/QgGtBTeraKyldC7cDVVvAJEOr3dFLKneez/n7BvX57UdhOqDsVwzU7UOnYA7AAOt+Xb26lk79PldDHgMIQ==}
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.24.3':
resolution: {integrity: sha512-KO0pN5x3+uZm1ZXeIfDqwcvnQ9UEGN8JX5ufhmgH5Lz4ujjZMAnxQygZAVGemFWn+ZZC0FQopruV4lqmGMshow==}
'@rollup/rollup-darwin-x64@4.24.4':
resolution: {integrity: sha512-N6oDBiZCBKlwYcsEPXGDE4g9RoxZLK6vT98M8111cW7VsVJFpNEqvJeIPfsCzbf0XEakPslh72X0gnlMi4Ddgg==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-freebsd-arm64@4.24.3':
resolution: {integrity: sha512-CsC+ZdIiZCZbBI+aRlWpYJMSWvVssPuWqrDy/zi9YfnatKKSLFCe6fjna1grHuo/nVaHG+kiglpRhyBQYRTK4A==}
'@rollup/rollup-freebsd-arm64@4.24.4':
resolution: {integrity: sha512-py5oNShCCjCyjWXCZNrRGRpjWsF0ic8f4ieBNra5buQz0O/U6mMXCpC1LvrHuhJsNPgRt36tSYMidGzZiJF6mw==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.24.3':
resolution: {integrity: sha512-F0nqiLThcfKvRQhZEzMIXOQG4EeX61im61VYL1jo4eBxv4aZRmpin6crnBJQ/nWnCsjH5F6J3W6Stdm0mBNqBg==}
'@rollup/rollup-freebsd-x64@4.24.4':
resolution: {integrity: sha512-L7VVVW9FCnTTp4i7KrmHeDsDvjB4++KOBENYtNYAiYl96jeBThFfhP6HVxL74v4SiZEVDH/1ILscR5U9S4ms4g==}
cpu: [x64]
os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.24.3':
resolution: {integrity: sha512-KRSFHyE/RdxQ1CSeOIBVIAxStFC/hnBgVcaiCkQaVC+EYDtTe4X7z5tBkFyRoBgUGtB6Xg6t9t2kulnX6wJc6A==}
'@rollup/rollup-linux-arm-gnueabihf@4.24.4':
resolution: {integrity: sha512-10ICosOwYChROdQoQo589N5idQIisxjaFE/PAnX2i0Zr84mY0k9zul1ArH0rnJ/fpgiqfu13TFZR5A5YJLOYZA==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.24.3':
resolution: {integrity: sha512-h6Q8MT+e05zP5BxEKz0vi0DhthLdrNEnspdLzkoFqGwnmOzakEHSlXfVyA4HJ322QtFy7biUAVFPvIDEDQa6rw==}
'@rollup/rollup-linux-arm-musleabihf@4.24.4':
resolution: {integrity: sha512-ySAfWs69LYC7QhRDZNKqNhz2UKN8LDfbKSMAEtoEI0jitwfAG2iZwVqGACJT+kfYvvz3/JgsLlcBP+WWoKCLcw==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.24.3':
resolution: {integrity: sha512-fKElSyXhXIJ9pqiYRqisfirIo2Z5pTTve5K438URf08fsypXrEkVmShkSfM8GJ1aUyvjakT+fn2W7Czlpd/0FQ==}
'@rollup/rollup-linux-arm64-gnu@4.24.4':
resolution: {integrity: sha512-uHYJ0HNOI6pGEeZ/5mgm5arNVTI0nLlmrbdph+pGXpC9tFHFDQmDMOEqkmUObRfosJqpU8RliYoGz06qSdtcjg==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-arm64-musl@4.24.3':
resolution: {integrity: sha512-YlddZSUk8G0px9/+V9PVilVDC6ydMz7WquxozToozSnfFK6wa6ne1ATUjUvjin09jp34p84milxlY5ikueoenw==}
'@rollup/rollup-linux-arm64-musl@4.24.4':
resolution: {integrity: sha512-38yiWLemQf7aLHDgTg85fh3hW9stJ0Muk7+s6tIkSUOMmi4Xbv5pH/5Bofnsb6spIwD5FJiR+jg71f0CH5OzoA==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-powerpc64le-gnu@4.24.3':
resolution: {integrity: sha512-yNaWw+GAO8JjVx3s3cMeG5Esz1cKVzz8PkTJSfYzE5u7A+NvGmbVFEHP+BikTIyYWuz0+DX9kaA3pH9Sqxp69g==}
'@rollup/rollup-linux-powerpc64le-gnu@4.24.4':
resolution: {integrity: sha512-q73XUPnkwt9ZNF2xRS4fvneSuaHw2BXuV5rI4cw0fWYVIWIBeDZX7c7FWhFQPNTnE24172K30I+dViWRVD9TwA==}
cpu: [ppc64]
os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.24.3':
resolution: {integrity: sha512-lWKNQfsbpv14ZCtM/HkjCTm4oWTKTfxPmr7iPfp3AHSqyoTz5AgLemYkWLwOBWc+XxBbrU9SCokZP0WlBZM9lA==}
'@rollup/rollup-linux-riscv64-gnu@4.24.4':
resolution: {integrity: sha512-Aie/TbmQi6UXokJqDZdmTJuZBCU3QBDA8oTKRGtd4ABi/nHgXICulfg1KI6n9/koDsiDbvHAiQO3YAUNa/7BCw==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.24.3':
resolution: {integrity: sha512-HoojGXTC2CgCcq0Woc/dn12wQUlkNyfH0I1ABK4Ni9YXyFQa86Fkt2Q0nqgLfbhkyfQ6003i3qQk9pLh/SpAYw==}
'@rollup/rollup-linux-s390x-gnu@4.24.4':
resolution: {integrity: sha512-P8MPErVO/y8ohWSP9JY7lLQ8+YMHfTI4bAdtCi3pC2hTeqFJco2jYspzOzTUB8hwUWIIu1xwOrJE11nP+0JFAQ==}
cpu: [s390x]
os: [linux]
'@rollup/rollup-linux-x64-gnu@4.24.3':
resolution: {integrity: sha512-mnEOh4iE4USSccBOtcrjF5nj+5/zm6NcNhbSEfR3Ot0pxBwvEn5QVUXcuOwwPkapDtGZ6pT02xLoPaNv06w7KQ==}
'@rollup/rollup-linux-x64-gnu@4.24.4':
resolution: {integrity: sha512-K03TljaaoPK5FOyNMZAAEmhlyO49LaE4qCsr0lYHUKyb6QacTNF9pnfPpXnFlFD3TXuFbFbz7tJ51FujUXkXYA==}
cpu: [x64]
os: [linux]
'@rollup/rollup-linux-x64-musl@4.24.3':
resolution: {integrity: sha512-rMTzawBPimBQkG9NKpNHvquIUTQPzrnPxPbCY1Xt+mFkW7pshvyIS5kYgcf74goxXOQk0CP3EoOC1zcEezKXhw==}
'@rollup/rollup-linux-x64-musl@4.24.4':
resolution: {integrity: sha512-VJYl4xSl/wqG2D5xTYncVWW+26ICV4wubwN9Gs5NrqhJtayikwCXzPL8GDsLnaLU3WwhQ8W02IinYSFJfyo34Q==}
cpu: [x64]
os: [linux]
'@rollup/rollup-win32-arm64-msvc@4.24.3':
resolution: {integrity: sha512-2lg1CE305xNvnH3SyiKwPVsTVLCg4TmNCF1z7PSHX2uZY2VbUpdkgAllVoISD7JO7zu+YynpWNSKAtOrX3AiuA==}
'@rollup/rollup-win32-arm64-msvc@4.24.4':
resolution: {integrity: sha512-ku2GvtPwQfCqoPFIJCqZ8o7bJcj+Y54cZSr43hHca6jLwAiCbZdBUOrqE6y29QFajNAzzpIOwsckaTFmN6/8TA==}
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.24.3':
resolution: {integrity: sha512-9SjYp1sPyxJsPWuhOCX6F4jUMXGbVVd5obVpoVEi8ClZqo52ViZewA6eFz85y8ezuOA+uJMP5A5zo6Oz4S5rVQ==}
'@rollup/rollup-win32-ia32-msvc@4.24.4':
resolution: {integrity: sha512-V3nCe+eTt/W6UYNr/wGvO1fLpHUrnlirlypZfKCT1fG6hWfqhPgQV/K/mRBXBpxc0eKLIF18pIOFVPh0mqHjlg==}
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.24.3':
resolution: {integrity: sha512-HGZgRFFYrMrP3TJlq58nR1xy8zHKId25vhmm5S9jETEfDf6xybPxsavFTJaufe2zgOGYJBskGlj49CwtEuFhWQ==}
'@rollup/rollup-win32-x64-msvc@4.24.4':
resolution: {integrity: sha512-LTw1Dfd0mBIEqUVCxbvTE/LLo+9ZxVC9k99v1v4ahg9Aak6FpqOfNu5kRkeTAn0wphoC4JU7No1/rL+bBCEwhg==}
cpu: [x64]
os: [win32]
@ -402,8 +402,8 @@ packages:
'@types/estree@1.0.6':
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
'@types/node@22.8.6':
resolution: {integrity: sha512-tosuJYKrIqjQIlVCM4PEGxOmyg3FCPa/fViuJChnGeEIhjA46oy8FMVoF9su1/v8PNs2a8Q0iFNyOx0uOF91nw==}
'@types/node@22.9.0':
resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==}
'@vitest/expect@2.1.4':
resolution: {integrity: sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA==}
@ -907,8 +907,8 @@ packages:
rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rollup@4.24.3:
resolution: {integrity: sha512-HBW896xR5HGmoksbi3JBDtmVzWiPAYqp7wip50hjQ67JbDz61nyoMPdqu1DvVW9asYb2M65Z20ZHsyJCMqMyDg==}
rollup@4.24.4:
resolution: {integrity: sha512-vGorVWIsWfX3xbcyAS+I047kFKapHYivmkaT63Smj77XwvLSJos6M1xGqZnBPFQFBRZDOcG1QnYEIxAvTr/HjA==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
@ -1164,11 +1164,11 @@ snapshots:
'@biomejs/cli-win32-x64@1.9.4':
optional: true
'@commitlint/cli@19.5.0(@types/node@22.8.6)(typescript@5.6.3)':
'@commitlint/cli@19.5.0(@types/node@22.9.0)(typescript@5.6.3)':
dependencies:
'@commitlint/format': 19.5.0
'@commitlint/lint': 19.5.0
'@commitlint/load': 19.5.0(@types/node@22.8.6)(typescript@5.6.3)
'@commitlint/load': 19.5.0(@types/node@22.9.0)(typescript@5.6.3)
'@commitlint/read': 19.5.0
'@commitlint/types': 19.5.0
tinyexec: 0.3.1
@ -1215,7 +1215,7 @@ snapshots:
'@commitlint/rules': 19.5.0
'@commitlint/types': 19.5.0
'@commitlint/load@19.5.0(@types/node@22.8.6)(typescript@5.6.3)':
'@commitlint/load@19.5.0(@types/node@22.9.0)(typescript@5.6.3)':
dependencies:
'@commitlint/config-validator': 19.5.0
'@commitlint/execute-rule': 19.5.0
@ -1223,7 +1223,7 @@ snapshots:
'@commitlint/types': 19.5.0
chalk: 5.3.0
cosmiconfig: 9.0.0(typescript@5.6.3)
cosmiconfig-typescript-loader: 5.1.0(@types/node@22.8.6)(cosmiconfig@9.0.0(typescript@5.6.3))(typescript@5.6.3)
cosmiconfig-typescript-loader: 5.1.0(@types/node@22.9.0)(cosmiconfig@9.0.0(typescript@5.6.3))(typescript@5.6.3)
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
lodash.uniq: 4.5.0
@ -1345,67 +1345,67 @@ snapshots:
'@jridgewell/sourcemap-codec@1.5.0': {}
'@rollup/rollup-android-arm-eabi@4.24.3':
'@rollup/rollup-android-arm-eabi@4.24.4':
optional: true
'@rollup/rollup-android-arm64@4.24.3':
'@rollup/rollup-android-arm64@4.24.4':
optional: true
'@rollup/rollup-darwin-arm64@4.24.3':
'@rollup/rollup-darwin-arm64@4.24.4':
optional: true
'@rollup/rollup-darwin-x64@4.24.3':
'@rollup/rollup-darwin-x64@4.24.4':
optional: true
'@rollup/rollup-freebsd-arm64@4.24.3':
'@rollup/rollup-freebsd-arm64@4.24.4':
optional: true
'@rollup/rollup-freebsd-x64@4.24.3':
'@rollup/rollup-freebsd-x64@4.24.4':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.24.3':
'@rollup/rollup-linux-arm-gnueabihf@4.24.4':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.24.3':
'@rollup/rollup-linux-arm-musleabihf@4.24.4':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.24.3':
'@rollup/rollup-linux-arm64-gnu@4.24.4':
optional: true
'@rollup/rollup-linux-arm64-musl@4.24.3':
'@rollup/rollup-linux-arm64-musl@4.24.4':
optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.24.3':
'@rollup/rollup-linux-powerpc64le-gnu@4.24.4':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.24.3':
'@rollup/rollup-linux-riscv64-gnu@4.24.4':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.24.3':
'@rollup/rollup-linux-s390x-gnu@4.24.4':
optional: true
'@rollup/rollup-linux-x64-gnu@4.24.3':
'@rollup/rollup-linux-x64-gnu@4.24.4':
optional: true
'@rollup/rollup-linux-x64-musl@4.24.3':
'@rollup/rollup-linux-x64-musl@4.24.4':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.24.3':
'@rollup/rollup-win32-arm64-msvc@4.24.4':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.24.3':
'@rollup/rollup-win32-ia32-msvc@4.24.4':
optional: true
'@rollup/rollup-win32-x64-msvc@4.24.3':
'@rollup/rollup-win32-x64-msvc@4.24.4':
optional: true
'@types/conventional-commits-parser@5.0.0':
dependencies:
'@types/node': 22.8.6
'@types/node': 22.9.0
'@types/estree@1.0.6': {}
'@types/node@22.8.6':
'@types/node@22.9.0':
dependencies:
undici-types: 6.19.8
@ -1416,13 +1416,13 @@ snapshots:
chai: 5.1.2
tinyrainbow: 1.2.0
'@vitest/mocker@2.1.4(vite@5.4.10(@types/node@22.8.6))':
'@vitest/mocker@2.1.4(vite@5.4.10(@types/node@22.9.0))':
dependencies:
'@vitest/spy': 2.1.4
estree-walker: 3.0.3
magic-string: 0.30.12
optionalDependencies:
vite: 5.4.10(@types/node@22.8.6)
vite: 5.4.10(@types/node@22.9.0)
'@vitest/pretty-format@2.1.4':
dependencies:
@ -1546,9 +1546,9 @@ snapshots:
meow: 12.1.1
split2: 4.2.0
cosmiconfig-typescript-loader@5.1.0(@types/node@22.8.6)(cosmiconfig@9.0.0(typescript@5.6.3))(typescript@5.6.3):
cosmiconfig-typescript-loader@5.1.0(@types/node@22.9.0)(cosmiconfig@9.0.0(typescript@5.6.3))(typescript@5.6.3):
dependencies:
'@types/node': 22.8.6
'@types/node': 22.9.0
cosmiconfig: 9.0.0(typescript@5.6.3)
jiti: 1.21.6
typescript: 5.6.3
@ -1873,28 +1873,28 @@ snapshots:
rfdc@1.4.1: {}
rollup@4.24.3:
rollup@4.24.4:
dependencies:
'@types/estree': 1.0.6
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.24.3
'@rollup/rollup-android-arm64': 4.24.3
'@rollup/rollup-darwin-arm64': 4.24.3
'@rollup/rollup-darwin-x64': 4.24.3
'@rollup/rollup-freebsd-arm64': 4.24.3
'@rollup/rollup-freebsd-x64': 4.24.3
'@rollup/rollup-linux-arm-gnueabihf': 4.24.3
'@rollup/rollup-linux-arm-musleabihf': 4.24.3
'@rollup/rollup-linux-arm64-gnu': 4.24.3
'@rollup/rollup-linux-arm64-musl': 4.24.3
'@rollup/rollup-linux-powerpc64le-gnu': 4.24.3
'@rollup/rollup-linux-riscv64-gnu': 4.24.3
'@rollup/rollup-linux-s390x-gnu': 4.24.3
'@rollup/rollup-linux-x64-gnu': 4.24.3
'@rollup/rollup-linux-x64-musl': 4.24.3
'@rollup/rollup-win32-arm64-msvc': 4.24.3
'@rollup/rollup-win32-ia32-msvc': 4.24.3
'@rollup/rollup-win32-x64-msvc': 4.24.3
'@rollup/rollup-android-arm-eabi': 4.24.4
'@rollup/rollup-android-arm64': 4.24.4
'@rollup/rollup-darwin-arm64': 4.24.4
'@rollup/rollup-darwin-x64': 4.24.4
'@rollup/rollup-freebsd-arm64': 4.24.4
'@rollup/rollup-freebsd-x64': 4.24.4
'@rollup/rollup-linux-arm-gnueabihf': 4.24.4
'@rollup/rollup-linux-arm-musleabihf': 4.24.4
'@rollup/rollup-linux-arm64-gnu': 4.24.4
'@rollup/rollup-linux-arm64-musl': 4.24.4
'@rollup/rollup-linux-powerpc64le-gnu': 4.24.4
'@rollup/rollup-linux-riscv64-gnu': 4.24.4
'@rollup/rollup-linux-s390x-gnu': 4.24.4
'@rollup/rollup-linux-x64-gnu': 4.24.4
'@rollup/rollup-linux-x64-musl': 4.24.4
'@rollup/rollup-win32-arm64-msvc': 4.24.4
'@rollup/rollup-win32-ia32-msvc': 4.24.4
'@rollup/rollup-win32-x64-msvc': 4.24.4
fsevents: 2.3.3
semver@7.6.3: {}
@ -1975,12 +1975,12 @@ snapshots:
unicorn-magic@0.1.0: {}
vite-node@2.1.4(@types/node@22.8.6):
vite-node@2.1.4(@types/node@22.9.0):
dependencies:
cac: 6.7.14
debug: 4.3.7
pathe: 1.1.2
vite: 5.4.10(@types/node@22.8.6)
vite: 5.4.10(@types/node@22.9.0)
transitivePeerDependencies:
- '@types/node'
- less
@ -1992,19 +1992,19 @@ snapshots:
- supports-color
- terser
vite@5.4.10(@types/node@22.8.6):
vite@5.4.10(@types/node@22.9.0):
dependencies:
esbuild: 0.21.5
postcss: 8.4.47
rollup: 4.24.3
rollup: 4.24.4
optionalDependencies:
'@types/node': 22.8.6
'@types/node': 22.9.0
fsevents: 2.3.3
vitest@2.1.4(@types/node@22.8.6):
vitest@2.1.4(@types/node@22.9.0):
dependencies:
'@vitest/expect': 2.1.4
'@vitest/mocker': 2.1.4(vite@5.4.10(@types/node@22.8.6))
'@vitest/mocker': 2.1.4(vite@5.4.10(@types/node@22.9.0))
'@vitest/pretty-format': 2.1.4
'@vitest/runner': 2.1.4
'@vitest/snapshot': 2.1.4
@ -2020,11 +2020,11 @@ snapshots:
tinyexec: 0.3.1
tinypool: 1.0.1
tinyrainbow: 1.2.0
vite: 5.4.10(@types/node@22.8.6)
vite-node: 2.1.4(@types/node@22.8.6)
vite: 5.4.10(@types/node@22.9.0)
vite-node: 2.1.4(@types/node@22.9.0)
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.8.6
'@types/node': 22.9.0
transitivePeerDependencies:
- less
- lightningcss

View File

@ -8,8 +8,6 @@ import type {
SeyfertBaseChoiceableOption,
SeyfertBasicOption,
SeyfertChoice,
SeyfertNumberOption,
SeyfertStringOption,
} from '../..';
import type { Attachment } from '../../builders';
import type {
@ -37,6 +35,7 @@ import type {
IgnoreCommand,
OnOptionsReturnObject,
PassFunction,
SeyfertChannelMap,
StopFunction,
UsingClient,
} from './shared';
@ -84,16 +83,18 @@ type ContextOptionsAuxInternal<
? Parameters<Parameters<T['value']>[1]>[0]
: NonNullable<T['value']> extends (...args: any) => any
? Parameters<Parameters<NonNullable<T['value']>>[1]>[0] extends never
? T extends SeyfertStringOption | SeyfertNumberOption
? NonNullable<T['choices']> extends SeyfertChoice<string | number>[]
? NonNullable<T['choices']>[number]['value']
: ReturnOptionsTypes[T['type']]
: ReturnOptionsTypes[T['type']]
? T extends { channel_types?: infer C }
? C extends any[]
? C[number] extends keyof SeyfertChannelMap
? SeyfertChannelMap[C[number]]
: never
: never
: T extends { choices?: infer C }
? C extends SeyfertChoice<string>[]
? C[number]['value']
: never
: never
: Parameters<Parameters<NonNullable<T['value']>>[1]>[0]
: T extends SeyfertStringOption | SeyfertNumberOption
? NonNullable<T['choices']> extends SeyfertChoice<string | number>[]
? NonNullable<T['choices']>[number]['value']
: ReturnOptionsTypes[T['type']]
: ReturnOptionsTypes[T['type']];
type ContextOptionsAux<T extends OptionsRecord> = {

View File

@ -13,11 +13,10 @@ import {
type APIApplicationCommandBasicOption,
type APIApplicationCommandOptionChoice,
ApplicationCommandOptionType,
type ChannelType,
} from '../../types';
import type { LocalizationMap } from '../../types/payloads';
import type { CommandContext } from './chatcontext';
import type { DefaultLocale, MiddlewareContext, OKFunction, StopFunction } from './shared';
import type { DefaultLocale, MiddlewareContext, OKFunction, SeyfertChannelMap, StopFunction } from './shared';
export interface SeyfertBasicOption<T extends keyof ReturnOptionsTypes, R = true | false> {
required?: R;
@ -77,7 +76,7 @@ export interface ChoiceableValues {
export type ValueCallback<
T extends keyof ReturnOptionsTypes,
C = T extends ChoiceableTypes ? SeyfertChoice<ChoiceableValues[T]>[] : never,
C = T extends ChoiceableTypes ? SeyfertChoice<ChoiceableValues[T]>[] : keyof SeyfertChannelMap,
I = any,
> = (
data: {
@ -86,9 +85,11 @@ export type ValueCallback<
? C extends SeyfertChoice<ChoiceableValues[T]>[]
? C[number]['value'] extends ReturnOptionsTypes[T]
? C[number]['value']
: ReturnOptionsTypes[T]
: ReturnOptionsTypes[T]
: ReturnOptionsTypes[T];
: never
: never
: C extends keyof SeyfertChannelMap
? SeyfertChannelMap[C]
: never;
},
ok: OKFunction<I>,
fail: StopFunction,
@ -129,8 +130,17 @@ export type SeyfertNumberOption<T = SeyfertChoice<number>[], R = boolean, VC = n
};
export type SeyfertBooleanOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Boolean, R>;
export type SeyfertUserOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.User, R>;
export type SeyfertChannelOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Channel, R> & {
channel_types?: ChannelType[];
export type SeyfertChannelOption<C = keyof SeyfertChannelMap, R = true | false, VC = never> = {
required?: R;
value?: ValueCallback<ApplicationCommandOptionType.Channel, C, VC>;
description: string;
description_localizations?: APIApplicationCommandBasicOption['description_localizations'];
name_localizations?: APIApplicationCommandBasicOption['name_localizations'];
locales?: {
name?: FlatObjectKeys<DefaultLocale>;
description?: FlatObjectKeys<DefaultLocale>;
};
channel_types?: C[];
};
export type SeyfertRoleOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Role, R>;
export type SeyfertMentionableOption<R = boolean> = SeyfertBasicOption<ApplicationCommandOptionType.Mentionable, R>;
@ -160,6 +170,14 @@ export function createNumberOption<
return { ...data, type: ApplicationCommandOptionType.Number } as const;
}
export function createChannelOption<
R extends boolean,
C extends keyof SeyfertChannelMap = keyof SeyfertChannelMap,
VC = never,
>(data: SeyfertChannelOption<C, R, VC>) {
return { ...data, type: ApplicationCommandOptionType.Channel } as const;
}
export function createBooleanOption<R extends boolean, T extends SeyfertBooleanOption<R> = SeyfertBooleanOption<R>>(
data: T,
) {
@ -170,12 +188,6 @@ export function createUserOption<R extends boolean, T extends SeyfertUserOption<
return { ...data, type: ApplicationCommandOptionType.User } as const;
}
export function createChannelOption<R extends boolean, T extends SeyfertChannelOption<R> = SeyfertChannelOption<R>>(
data: T,
) {
return { ...data, type: ApplicationCommandOptionType.Channel } as const;
}
export function createRoleOption<R extends boolean, T extends SeyfertRoleOption<R> = SeyfertRoleOption<R>>(data: T) {
return { ...data, type: ApplicationCommandOptionType.Role } as const;
}

View File

@ -1,6 +1,18 @@
import type {
CategoryChannelStructure,
DMChannelStructure,
DirectoryChannelStructure,
ForumChannelStructure,
MediaChannelStructure,
NewsChannelStructure,
StageChannelStructure,
TextGuildChannelStructure,
ThreadChannelStructure,
VoiceChannelStructure,
} from '../../client';
import type { BaseClient } from '../../client/base';
import type { IsStrictlyUndefined } from '../../common';
import type { ChannelType } from '../../types';
import { ChannelType } from '../../types';
import type { RegisteredMiddlewares } from '../decorators';
export type OKFunction<T> = (value: T) => void;
@ -80,3 +92,19 @@ export enum IgnoreCommand {
Slash = 0,
Message = 1,
}
export interface SeyfertChannelMap {
[ChannelType.GuildText]: TextGuildChannelStructure;
[ChannelType.DM]: DMChannelStructure;
[ChannelType.GuildVoice]: VoiceChannelStructure;
[ChannelType.GroupDM]: DMChannelStructure;
[ChannelType.GuildCategory]: CategoryChannelStructure;
[ChannelType.GuildAnnouncement]: NewsChannelStructure;
[ChannelType.AnnouncementThread]: ThreadChannelStructure;
[ChannelType.PublicThread]: ThreadChannelStructure;
[ChannelType.PrivateThread]: ThreadChannelStructure;
[ChannelType.GuildStageVoice]: StageChannelStructure;
[ChannelType.GuildDirectory]: DirectoryChannelStructure;
[ChannelType.GuildForum]: ForumChannelStructure;
[ChannelType.GuildMedia]: MediaChannelStructure;
}

View File

@ -58,7 +58,7 @@ import type { GuildMember } from './GuildMember';
import type { GuildRole } from './GuildRole';
import { DiscordBase } from './extra/DiscordBase';
export class BaseChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
export class BaseNoEditableChannel<T extends ChannelType> extends DiscordBase<APIChannelBase<ChannelType>> {
declare type: T;
constructor(client: UsingClient, data: APIChannelBase<ChannelType>) {
@ -84,13 +84,6 @@ export class BaseChannel<T extends ChannelType> extends DiscordBase<APIChannelBa
return this.client.channels.delete(this.id, { reason });
}
edit(body: RESTPatchAPIChannelJSONBody, reason?: string) {
return this.client.channels.edit(this.id, body, {
reason,
guildId: 'guildId' in this ? (this.guildId as string) : '@me',
});
}
toString() {
return Formatter.channelMention(this.id);
}
@ -165,6 +158,15 @@ export class BaseChannel<T extends ChannelType> extends DiscordBase<APIChannelBa
}
}
export class BaseChannel<T extends ChannelType> extends BaseNoEditableChannel<T> {
edit(body: RESTPatchAPIChannelJSONBody, reason?: string) {
return this.client.channels.edit(this.id, body, {
reason,
guildId: 'guildId' in this ? (this.guildId as string) : '@me',
});
}
}
interface IChannelTypes {
GuildStageVoice: StageChannel;
GuildMedia: MediaChannel;
@ -225,7 +227,7 @@ export class BaseGuildChannel extends BaseChannel<ChannelType> {
}
}
export interface MessagesMethods extends BaseChannel<ChannelType> {}
export interface MessagesMethods extends BaseNoEditableChannel<ChannelType> {}
export class MessagesMethods extends DiscordBase {
typing() {
return this.client.channels.typing(this.id);
@ -467,12 +469,9 @@ export class TextGuildChannel extends BaseGuildChannel {
}
}
export interface DMChannel extends ObjectToLower<APIDMChannel>, Omit<MessagesMethods, 'edit'> {}
export interface DMChannel extends ObjectToLower<APIDMChannel>, MessagesMethods {}
@mix(MessagesMethods)
export class DMChannel extends (BaseChannel<ChannelType.DM> as unknown as ToClass<
Omit<BaseChannel<ChannelType.DM>, 'edit'>,
DMChannel
>) {
export class DMChannel extends BaseNoEditableChannel<ChannelType.DM> {
declare type: ChannelType.DM;
}
export interface VoiceChannel