diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..92d358b34 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +/typings/**/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6294e7f8b..d595b1cef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,7 +58,7 @@ jobs: - name: Register Problem Matcher run: echo "##[add-matcher].github/tsc.json" - - name: Run TypeScript compiler + - name: Run Type Tests run: npm run test:typescript docs: diff --git a/package-lock.json b/package-lock.json index d6a405eab..8647a1367 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "jest": "^27.3.1", "lint-staged": "^11.2.6", "prettier": "^2.4.1", + "tsd": "^0.18.0", "tslint": "^6.1.3", "typescript": "^4.5.2" }, @@ -2083,6 +2084,41 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@npmcli/move-file": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", @@ -2178,6 +2214,16 @@ "node": ">= 6" } }, + "node_modules/@tsd/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-XNaotnbhU6sKSXYg9rVz4L9i9g+j+x1IIgMPztK8KumtMEsrLXcqPBKp/qzmUKwAZEqgHs4+TTz90dUu5/aIqQ==", + "dev": true, + "bin": { + "tsc": "typescript/bin/tsc", + "tsserver": "typescript/bin/tsserver" + } + }, "node_modules/@types/babel__core": { "version": "7.1.16", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz", @@ -2219,6 +2265,22 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/eslint": { + "version": "7.28.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.2.tgz", + "integrity": "sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", + "dev": true + }, "node_modules/@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -2252,6 +2314,12 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -2608,6 +2676,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -4127,6 +4204,18 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/discord-api-types": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz", @@ -5002,6 +5091,28 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-formatter-pretty": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz", + "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==", + "dev": true, + "dependencies": { + "@types/eslint": "^7.2.13", + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "eslint-rule-docs": "^1.1.5", + "log-symbols": "^4.0.0", + "plur": "^4.0.0", + "string-width": "^4.2.0", + "supports-hyperlinks": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint-import-resolver-node": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", @@ -5186,6 +5297,12 @@ } } }, + "node_modules/eslint-rule-docs": { + "version": "1.1.231", + "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz", + "integrity": "sha512-egHz9A1WG7b8CS0x1P6P/Rj5FqZOjray/VjpJa14tMZalfRKvpE2ONJ3plCM7+PcinmU4tcmbPLv0VtwzSdLVA==", + "dev": true + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -5512,6 +5629,22 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "node_modules/fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -5524,6 +5657,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", @@ -6312,6 +6454,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -6806,6 +6977,15 @@ "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", "dev": true }, + "node_modules/irregular-plurals": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.3.0.tgz", + "integrity": "sha512-MVBLKUTangM3EfRPFROhmWQQKRDsrgI83J8GS3jXy+OwYqiR2/aoWndYQ5416jLE3uaGgLH7ncme3X9y09gZ3g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -7101,6 +7281,18 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -8491,6 +8683,22 @@ "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=", "dev": true }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/log-update": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", @@ -8864,6 +9072,15 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -9819,6 +10036,21 @@ "semver-compare": "^1.0.0" } }, + "node_modules/plur": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", + "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", + "dev": true, + "dependencies": { + "irregular-plurals": "^3.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -9969,6 +10201,26 @@ "node": ">=0.6" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", @@ -10436,6 +10688,16 @@ "node": "*" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -10460,6 +10722,29 @@ "node": ">=0.12.0" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -11400,6 +11685,187 @@ "node": ">=4" } }, + "node_modules/tsd": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.18.0.tgz", + "integrity": "sha512-UIkxm2CLmSjXlQs4zqxgVV9UmzK8VgJ63eBpgkH/ZsMkiUdzxxHvdCCg8F314HDxzfQl2muJEy/TEcXHIFIPXg==", + "dev": true, + "dependencies": { + "@tsd/typescript": "~4.4.3", + "eslint-formatter-pretty": "^4.1.0", + "globby": "^11.0.1", + "meow": "^9.0.0", + "path-exists": "^4.0.0", + "read-pkg-up": "^7.0.0" + }, + "bin": { + "tsd": "dist/cli.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/tsd/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tsd/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tsd/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tsd/node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/tsd/node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tsd/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/tsd/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -13751,6 +14217,32 @@ "chalk": "^4.0.0" } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@npmcli/move-file": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", @@ -13818,6 +14310,12 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@tsd/typescript": { + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-XNaotnbhU6sKSXYg9rVz4L9i9g+j+x1IIgMPztK8KumtMEsrLXcqPBKp/qzmUKwAZEqgHs4+TTz90dUu5/aIqQ==", + "dev": true + }, "@types/babel__core": { "version": "7.1.16", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz", @@ -13859,6 +14357,22 @@ "@babel/types": "^7.3.0" } }, + "@types/eslint": { + "version": "7.28.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.2.tgz", + "integrity": "sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", + "dev": true + }, "@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -13892,6 +14406,12 @@ "@types/istanbul-lib-report": "*" } }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -14182,6 +14702,12 @@ "is-string": "^1.0.7" } }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -15371,6 +15897,15 @@ "integrity": "sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "discord-api-types": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz", @@ -16108,6 +16643,22 @@ "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", "dev": true }, + "eslint-formatter-pretty": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-formatter-pretty/-/eslint-formatter-pretty-4.1.0.tgz", + "integrity": "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ==", + "dev": true, + "requires": { + "@types/eslint": "^7.2.13", + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "eslint-rule-docs": "^1.1.5", + "log-symbols": "^4.0.0", + "plur": "^4.0.0", + "string-width": "^4.2.0", + "supports-hyperlinks": "^2.0.0" + } + }, "eslint-import-resolver-node": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", @@ -16256,6 +16807,12 @@ "prettier-linter-helpers": "^1.0.0" } }, + "eslint-rule-docs": { + "version": "1.1.231", + "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz", + "integrity": "sha512-egHz9A1WG7b8CS0x1P6P/Rj5FqZOjray/VjpJa14tMZalfRKvpE2ONJ3plCM7+PcinmU4tcmbPLv0VtwzSdLVA==", + "dev": true + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -16451,6 +17008,19 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -16463,6 +17033,15 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "fb-watchman": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", @@ -17070,6 +17649,28 @@ "type-fest": "^0.20.2" } }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "dependencies": { + "ignore": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", + "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "dev": true + } + } + }, "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", @@ -17432,6 +18033,12 @@ "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", "dev": true }, + "irregular-plurals": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.3.0.tgz", + "integrity": "sha512-MVBLKUTangM3EfRPFROhmWQQKRDsrgI83J8GS3jXy+OwYqiR2/aoWndYQ5416jLE3uaGgLH7ncme3X9y09gZ3g==", + "dev": true + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -17628,6 +18235,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -18721,6 +19334,16 @@ "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=", "dev": true }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, "log-update": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", @@ -19007,6 +19630,12 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -19745,6 +20374,15 @@ "semver-compare": "^1.0.0" } }, + "plur": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-4.0.0.tgz", + "integrity": "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg==", + "dev": true, + "requires": { + "irregular-plurals": "^3.2.0" + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -19856,6 +20494,12 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", @@ -20224,6 +20868,12 @@ "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -20239,6 +20889,15 @@ "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", "dev": true }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -20998,6 +21657,142 @@ } } }, + "tsd": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.18.0.tgz", + "integrity": "sha512-UIkxm2CLmSjXlQs4zqxgVV9UmzK8VgJ63eBpgkH/ZsMkiUdzxxHvdCCg8F314HDxzfQl2muJEy/TEcXHIFIPXg==", + "dev": true, + "requires": { + "@tsd/typescript": "~4.4.3", + "eslint-formatter-pretty": "^4.1.0", + "globby": "^11.0.1", + "meow": "^9.0.0", + "path-exists": "^4.0.0", + "read-pkg-up": "^7.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "meow": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", + "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", + "dev": true, + "requires": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize": "^1.2.0", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true + } + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", diff --git a/package.json b/package.json index 3fffdcf75..1a73c0053 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A powerful library for interacting with the Discord API", "scripts": { "test": "npm run lint && npm run docs:test && npm run lint:typings && npm run test:typescript", - "test:typescript": "tsc --noEmit", + "test:typescript": "tsc --noEmit && tsd", "lint": "eslint src", "lint:fix": "eslint src --fix", "lint:typings": "tslint typings/index.d.ts", @@ -76,6 +76,7 @@ "jest": "^27.3.1", "lint-staged": "^11.2.6", "prettier": "^2.4.1", + "tsd": "^0.18.0", "tslint": "^6.1.3", "typescript": "^4.5.2" }, diff --git a/typings/tests.ts b/typings/index.test-d.ts similarity index 65% rename from typings/tests.ts rename to typings/index.test-d.ts index 05c471cef..9eb72d8e9 100644 --- a/typings/tests.ts +++ b/typings/index.test-d.ts @@ -1,6 +1,5 @@ import type { ChildProcess } from 'child_process'; import type { - APIGuildMember, APIInteractionGuildMember, APIMessage, APIPartialChannel, @@ -11,11 +10,8 @@ import type { } from 'discord-api-types/v9'; import { ApplicationCommand, - ApplicationCommandChannelOptionData, - ApplicationCommandChoicesData, ApplicationCommandData, ApplicationCommandManager, - ApplicationCommandNonOptionsData, ApplicationCommandOptionData, ApplicationCommandResolvable, ApplicationCommandSubCommandData, @@ -81,12 +77,15 @@ import { User, VoiceChannel, Shard, - ApplicationCommandAutocompleteOption, - ApplicationCommandNumericOptionData, WebSocketShard, Collector, } from '.'; import type { ApplicationCommandOptionTypes } from './enums'; +import { expectAssignable, expectDeprecated, expectNotAssignable, expectNotType, expectType } from 'tsd'; + +// Test type transformation: +declare const serialize: (value: T) => Serialized; +declare const notPropertyOf: (value: T, property: P & Exclude) => void; const client: Client = new Client({ intents: Intents.FLAGS.GUILDS, @@ -115,8 +114,10 @@ client.on('ready', async () => { console.log(`Client is logged in as ${client.user!.tag} and ready!`); // Test fetching all global commands and ones from one guild - assertType>(await client.application!.commands.fetch()); - assertType>( + expectType>>( + await client.application!.commands.fetch(), + ); + expectType>>( await client.application!.commands.fetch({ guildId: testGuildId }), ); @@ -449,78 +450,16 @@ client.on('ready', async () => { }); }); -// This is to check that stuff is the right type -declare const assertIsPromiseMember: (m: Promise) => void; - -const baseCommandOptionData = { - name: 'test', - description: 'test', -}; - -assertType({ - ...baseCommandOptionData, - type: 'STRING', - autocomplete: true, - // @ts-expect-error - choices: [], -}); - -assertType({ - ...baseCommandOptionData, - type: 'STRING', - autocomplete: false, - choices: [], -}); - -assertType({ - ...baseCommandOptionData, - type: 'STRING', - choices: [], -}); - -assertType({ - ...baseCommandOptionData, - type: 'NUMBER', - autocomplete: true, - // @ts-expect-error - choices: [], -}); - -assertType({ - ...baseCommandOptionData, - type: 'INTEGER', - autocomplete: true, - // @ts-expect-error - choices: [], -}); - -assertType({ - ...baseCommandOptionData, - type: 'NUMBER', - autocomplete: true, -}); - -assertType({ - ...baseCommandOptionData, - type: 'STRING', - autocomplete: true, -}); - -assertType({ - ...baseCommandOptionData, - type: 'INTEGER', - autocomplete: true, -}); - client.on('guildCreate', async g => { const channel = g.channels.cache.random(); if (!channel) return; if (channel.isThread()) { const fetchedMember = await channel.members.fetch('12345678'); - assertType(fetchedMember); + expectType(fetchedMember); const fetchedMemberCol = await channel.members.fetch(true); - assertType>(fetchedMemberCol); + expectDeprecated(await channel.members.fetch(true)); + expectType>(fetchedMemberCol); } channel.setName('foo').then(updatedChannel => { @@ -528,21 +467,23 @@ client.on('guildCreate', async g => { }); // @ts-expect-error no options - assertIsPromiseMember(g.members.add(testUserId)); + expectNotType>(g.members.add(testUserId)); // @ts-expect-error no access token - assertIsPromiseMember(g.members.add(testUserId, {})); + expectNotType>(g.members.add(testUserId, {})); - // @ts-expect-error invalid role resolvable - assertIsPromiseMember(g.members.add(testUserId, { accessToken: 'totallyRealAccessToken', roles: [g.roles.cache] })); + expectNotType>( + // @ts-expect-error invalid role resolvable + g.members.add(testUserId, { accessToken: 'totallyRealAccessToken', roles: [g.roles.cache] }), + ); - assertType>( + expectType>( g.members.add(testUserId, { accessToken: 'totallyRealAccessToken', fetchWhenExisting: false }), ); - assertIsPromiseMember(g.members.add(testUserId, { accessToken: 'totallyRealAccessToken' })); + expectType>(g.members.add(testUserId, { accessToken: 'totallyRealAccessToken' })); - assertIsPromiseMember( + expectType>( g.members.add(testUserId, { accessToken: 'totallyRealAccessToken', mute: true, @@ -578,20 +519,18 @@ client.on('messageCreate', async message => { assertIsMessage(channel.send({ embeds: [embed], files: [attachment] })); if (message.inGuild()) { - assertType>(message); + expectAssignable>(message); const component = await message.awaitMessageComponent({ componentType: 'BUTTON' }); - assertType>(component); - assertType>(await component.reply({ fetchReply: true })); + expectType>(component); + expectType>(await component.reply({ fetchReply: true })); const buttonCollector = message.createMessageComponentCollector({ componentType: 'BUTTON' }); - assertType>>(buttonCollector); - assertType(message.channel); + expectType>>(buttonCollector); + expectType(message.channel); } - assertType(message.channel); - - // @ts-expect-error - assertType(message.channel); + expectType(message.channel); + expectNotType(message.channel); // @ts-expect-error channel.send(); @@ -602,27 +541,27 @@ client.on('messageCreate', async message => { // Verify that buttons interactions are inferred. const buttonCollector = message.createMessageComponentCollector({ componentType: 'BUTTON' }); - assertType>(message.awaitMessageComponent({ componentType: 'BUTTON' })); - assertType>(channel.awaitMessageComponent({ componentType: 'BUTTON' })); - assertType>(buttonCollector); + expectAssignable>(message.awaitMessageComponent({ componentType: 'BUTTON' })); + expectAssignable>(channel.awaitMessageComponent({ componentType: 'BUTTON' })); + expectAssignable>(buttonCollector); // Verify that select menus interaction are inferred. const selectMenuCollector = message.createMessageComponentCollector({ componentType: 'SELECT_MENU' }); - assertType>(message.awaitMessageComponent({ componentType: 'SELECT_MENU' })); - assertType>(channel.awaitMessageComponent({ componentType: 'SELECT_MENU' })); - assertType>(selectMenuCollector); + expectAssignable>(message.awaitMessageComponent({ componentType: 'SELECT_MENU' })); + expectAssignable>(channel.awaitMessageComponent({ componentType: 'SELECT_MENU' })); + expectAssignable>(selectMenuCollector); // Verify that message component interactions are default collected types. const defaultCollector = message.createMessageComponentCollector(); - assertType>(message.awaitMessageComponent()); - assertType>(channel.awaitMessageComponent()); - assertType>(defaultCollector); + expectAssignable>(message.awaitMessageComponent()); + expectAssignable>(channel.awaitMessageComponent()); + expectAssignable>(defaultCollector); // Verify that additional options don't affect default collector types. const semiDefaultCollector = message.createMessageComponentCollector({ time: 10000 }); - assertType>(semiDefaultCollector); + expectType>(semiDefaultCollector); const semiDefaultCollectorChannel = message.createMessageComponentCollector({ time: 10000 }); - assertType>(semiDefaultCollectorChannel); + expectType>(semiDefaultCollectorChannel); // Verify that interaction collector options can't be used. @@ -632,7 +571,7 @@ client.on('messageCreate', async message => { // Make sure filter parameters are properly inferred. message.createMessageComponentCollector({ filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -640,7 +579,7 @@ client.on('messageCreate', async message => { message.createMessageComponentCollector({ componentType: 'BUTTON', filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -648,14 +587,14 @@ client.on('messageCreate', async message => { message.createMessageComponentCollector({ componentType: 'SELECT_MENU', filter: i => { - assertType(i); + expectType(i); return true; }, }); message.awaitMessageComponent({ filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -663,7 +602,7 @@ client.on('messageCreate', async message => { message.awaitMessageComponent({ componentType: 'BUTTON', filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -671,7 +610,7 @@ client.on('messageCreate', async message => { message.awaitMessageComponent({ componentType: 'SELECT_MENU', filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -679,22 +618,19 @@ client.on('messageCreate', async message => { const webhook = await message.fetchWebhook(); if (webhook.isChannelFollower()) { - assertType(webhook.sourceGuild); - assertType(webhook.sourceChannel); + expectAssignable(webhook.sourceGuild); + expectAssignable(webhook.sourceChannel); } else if (webhook.isIncoming()) { - assertType(webhook.token); + expectType(webhook.token); } - // @ts-expect-error - assertType(webhook.sourceGuild); - // @ts-expect-error - assertType(webhook.sourceChannel); - // @ts-expect-error - assertType(webhook.token); + expectNotType(webhook.sourceGuild); + expectNotType(webhook.sourceChannel); + expectNotType(webhook.token); channel.awaitMessageComponent({ filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -702,7 +638,7 @@ client.on('messageCreate', async message => { channel.awaitMessageComponent({ componentType: 'BUTTON', filter: i => { - assertType(i); + expectType(i); return true; }, }); @@ -710,16 +646,16 @@ client.on('messageCreate', async message => { channel.awaitMessageComponent({ componentType: 'SELECT_MENU', filter: i => { - assertType(i); + expectType(i); return true; }, }); }); client.on('interaction', async interaction => { - assertType(interaction.guildId); - assertType(interaction.channelId); - assertType(interaction.member); + expectType(interaction.guildId); + expectType(interaction.channelId); + expectType(interaction.member); if (!interaction.isCommand()) return; @@ -732,7 +668,7 @@ client.on('interaction', async interaction => { await interaction.reply({ content: 'Hi!', components: [actionRow] }); // @ts-expect-error - await interaction.reply({ content: 'Hi!', components: [[button]] }); + interaction.reply({ content: 'Hi!', components: [[button]] }); // @ts-expect-error void new MessageActionRow({}); @@ -741,7 +677,7 @@ client.on('interaction', async interaction => { await interaction.reply({ content: 'Hi!', components: [button] }); if (interaction.isMessageComponent()) { - assertType(interaction.channelId); + expectType(interaction.channelId); } }); @@ -749,35 +685,30 @@ client.login('absolutely-valid-token'); // Test client conditional types client.on('ready', client => { - assertType>(client); + expectType>(client); }); declare const loggedInClient: Client; -assertType(loggedInClient.application); -assertType(loggedInClient.readyAt); -assertType(loggedInClient.readyTimestamp); -assertType(loggedInClient.token); -assertType(loggedInClient.uptime); -assertType(loggedInClient.user); +expectType(loggedInClient.application); +expectType(loggedInClient.readyAt); +expectType(loggedInClient.readyTimestamp); +expectType(loggedInClient.token); +expectType(loggedInClient.uptime); +expectType(loggedInClient.user); declare const loggedOutClient: Client; -assertType(loggedOutClient.application); -assertType(loggedOutClient.readyAt); -assertType(loggedOutClient.readyTimestamp); -assertType(loggedOutClient.token); -assertType(loggedOutClient.uptime); -assertType(loggedOutClient.user); +expectType(loggedOutClient.application); +expectType(loggedOutClient.readyAt); +expectType(loggedOutClient.readyTimestamp); +expectType(loggedOutClient.token); +expectType(loggedOutClient.uptime); +expectType(loggedOutClient.user); -// Test type transformation: -declare const assertType: (value: T) => asserts value is T; -declare const serialize: (value: T) => Serialized; -declare const notPropertyOf: (value: T, property: P & Exclude) => void; - -assertType(serialize(undefined)); -assertType(serialize(null)); -assertType(serialize([1, 2, 3])); -assertType<{}>(serialize(new Set([1, 2, 3]))); -assertType<{}>( +expectType(serialize(undefined)); +expectType(serialize(null)); +expectType(serialize([1, 2, 3])); +expectType<{}>(serialize(new Set([1, 2, 3]))); +expectType<{}>( serialize( new Map([ [1, '2'], @@ -785,9 +716,9 @@ assertType<{}>( ]), ), ); -assertType(serialize(new Permissions(Permissions.FLAGS.ATTACH_FILES))); -assertType(serialize(new Intents(Intents.FLAGS.GUILDS))); -assertType( +expectType(serialize(new Permissions(Permissions.FLAGS.ATTACH_FILES))); +expectType(serialize(new Intents(Intents.FLAGS.GUILDS))); +expectAssignable( serialize( new Collection([ [1, '2'], @@ -795,18 +726,18 @@ assertType( ]), ), ); -assertType(serialize(Symbol('a'))); -assertType(serialize(() => {})); -assertType(serialize(BigInt(42))); +expectType(serialize(Symbol('a'))); +expectType(serialize(() => {})); +expectType(serialize(BigInt(42))); // Test type return of broadcastEval: declare const shardClientUtil: ShardClientUtil; declare const shardingManager: ShardingManager; -assertType>(shardingManager.broadcastEval(() => 1)); -assertType>(shardClientUtil.broadcastEval(() => 1)); -assertType>(shardingManager.broadcastEval(async () => 1)); -assertType>(shardClientUtil.broadcastEval(async () => 1)); +expectType>(shardingManager.broadcastEval(() => 1)); +expectType>(shardClientUtil.broadcastEval(() => 1)); +expectType>(shardingManager.broadcastEval(async () => 1)); +expectType>(shardClientUtil.broadcastEval(async () => 1)); declare const dmChannel: DMChannel; declare const threadChannel: ThreadChannel; @@ -816,17 +747,17 @@ declare const user: User; declare const guildMember: GuildMember; // Test whether the structures implement send -assertType(dmChannel.send); -assertType(threadChannel); -assertType(newsChannel); -assertType(textChannel); -assertType(user); -assertType(guildMember); +expectType(dmChannel.send); +expectType(threadChannel); +expectType(newsChannel); +expectType(textChannel); +expectAssignable(user); +expectAssignable(guildMember); -assertType(dmChannel.lastMessage); -assertType(threadChannel.lastMessage); -assertType(newsChannel.lastMessage); -assertType(textChannel.lastMessage); +expectType(dmChannel.lastMessage); +expectType(threadChannel.lastMessage); +expectType(newsChannel.lastMessage); +expectType(textChannel.lastMessage); notPropertyOf(user, 'lastMessage'); notPropertyOf(user, 'lastMessageId'); @@ -836,21 +767,21 @@ notPropertyOf(guildMember, 'lastMessageId'); // Test collector event parameters declare const messageCollector: MessageCollector; messageCollector.on('collect', (...args) => { - assertType<[Message]>(args); + expectType<[Message]>(args); }); declare const reactionCollector: ReactionCollector; reactionCollector.on('dispose', (...args) => { - assertType<[MessageReaction, User]>(args); + expectType<[MessageReaction, User]>(args); }); // Make sure the properties are typed correctly, and that no backwards properties // (K -> V and V -> K) exist: -assertType<'messageCreate'>(Constants.Events.MESSAGE_CREATE); -assertType<'close'>(Constants.ShardEvents.CLOSE); -assertType<1>(Constants.Status.CONNECTING); -assertType<0>(Constants.Opcodes.DISPATCH); -assertType<2>(Constants.ClientApplicationAssetTypes.BIG); +expectType<'messageCreate'>(Constants.Events.MESSAGE_CREATE); +expectType<'close'>(Constants.ShardEvents.CLOSE); +expectType<1>(Constants.Status.CONNECTING); +expectType<0>(Constants.Opcodes.DISPATCH); +expectType<2>(Constants.ClientApplicationAssetTypes.BIG); declare const applicationCommandData: ApplicationCommandData; declare const applicationCommandResolvable: ApplicationCommandResolvable; @@ -858,19 +789,18 @@ declare const applicationCommandManager: ApplicationCommandManager; { type ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>; - assertType>(applicationCommandManager.create(applicationCommandData)); - assertType>(applicationCommandManager.create(applicationCommandData, '0')); - assertType>(applicationCommandManager.create(applicationCommandData, undefined)); - assertType>( + expectType>(applicationCommandManager.create(applicationCommandData)); + expectAssignable>(applicationCommandManager.create(applicationCommandData, '0')); + expectType>( applicationCommandManager.edit(applicationCommandResolvable, applicationCommandData), ); - assertType>( + expectType>( applicationCommandManager.edit(applicationCommandResolvable, applicationCommandData, '0'), ); - assertType>>( + expectType>>( applicationCommandManager.set([applicationCommandData]), ); - assertType>>( + expectType>>( applicationCommandManager.set([applicationCommandData], '0'), ); } @@ -887,272 +817,248 @@ declare const applicationNonChoiceOptionData: ApplicationCommandOptionData & { declare const applicationSubGroupCommandData: ApplicationCommandSubGroupData; { - assertType<'SUB_COMMAND_GROUP' | ApplicationCommandOptionTypes.SUB_COMMAND_GROUP>( + expectType<'SUB_COMMAND_GROUP' | ApplicationCommandOptionTypes.SUB_COMMAND_GROUP>( applicationSubGroupCommandData.type, ); - assertType(applicationSubGroupCommandData.options); -} - -declare const applicationSubCommandData: ApplicationCommandSubCommandData; -{ - assertType<'SUB_COMMAND' | ApplicationCommandOptionTypes.SUB_COMMAND>(applicationSubCommandData.type); - - // Check that only subcommands can have no subcommand or subcommand group sub-options. - assertType< - | ( - | ApplicationCommandChoicesData - | ApplicationCommandNonOptionsData - | ApplicationCommandChannelOptionData - | ApplicationCommandAutocompleteOption - | ApplicationCommandNumericOptionData - )[] - | undefined - >(applicationSubCommandData.options); + expectType(applicationSubGroupCommandData.options); } declare const guildApplicationCommandManager: GuildApplicationCommandManager; -assertType>>(guildApplicationCommandManager.fetch()); -assertType>>(guildApplicationCommandManager.fetch(undefined, {})); -assertType>(guildApplicationCommandManager.fetch('0')); +expectType>>(guildApplicationCommandManager.fetch()); +expectType>>(guildApplicationCommandManager.fetch(undefined, {})); +expectType>(guildApplicationCommandManager.fetch('0')); declare const guildChannelManager: GuildChannelManager; { type AnyChannel = TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel; - assertType>(guildChannelManager.create('name', { type: 'GUILD_VOICE' })); - assertType>(guildChannelManager.create('name', { type: 'GUILD_CATEGORY' })); - assertType>(guildChannelManager.create('name', { type: 'GUILD_TEXT' })); - assertType>(guildChannelManager.create('name', { type: 'GUILD_NEWS' })); - assertType>(guildChannelManager.create('name', { type: 'GUILD_STORE' })); - assertType>(guildChannelManager.create('name', { type: 'GUILD_STAGE_VOICE' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_VOICE' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_CATEGORY' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_TEXT' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_NEWS' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_STORE' })); + expectType>(guildChannelManager.create('name', { type: 'GUILD_STAGE_VOICE' })); - assertType>>(guildChannelManager.fetch()); - assertType>>(guildChannelManager.fetch(undefined, {})); - assertType>(guildChannelManager.fetch('0')); + expectType>>(guildChannelManager.fetch()); + expectType>>(guildChannelManager.fetch(undefined, {})); + expectType>(guildChannelManager.fetch('0')); } declare const roleManager: RoleManager; -assertType>>(roleManager.fetch()); -assertType>>(roleManager.fetch(undefined, {})); -assertType>(roleManager.fetch('0')); +expectType>>(roleManager.fetch()); +expectType>>(roleManager.fetch(undefined, {})); +expectType>(roleManager.fetch('0')); declare const guildEmojiManager: GuildEmojiManager; -assertType>>(guildEmojiManager.fetch()); -assertType>>(guildEmojiManager.fetch(undefined, {})); -assertType>(guildEmojiManager.fetch('0')); +expectType>>(guildEmojiManager.fetch()); +expectType>>(guildEmojiManager.fetch(undefined, {})); +expectType>(guildEmojiManager.fetch('0')); declare const typing: Typing; -assertType(typing.user); -if (typing.user.partial) assertType(typing.user.username); +expectType(typing.user); +if (typing.user.partial) expectType(typing.user.username); -assertType(typing.channel); -if (typing.channel.partial) assertType(typing.channel.lastMessageId); +expectType(typing.channel); +if (typing.channel.partial) expectType(typing.channel.lastMessageId); -assertType(typing.member); -assertType(typing.guild); +expectType(typing.member); +expectType(typing.guild); if (typing.inGuild()) { - assertType(typing.channel.guild); - assertType(typing.guild); + expectType(typing.channel.guild); + expectType(typing.guild); } // Test partials structures client.on('guildMemberRemove', member => { - if (member.partial) return assertType(member.joinedAt); - assertType(member.joinedAt); + if (member.partial) return expectType(member.joinedAt); + expectType(member.joinedAt); }); client.on('messageReactionAdd', async reaction => { if (reaction.partial) { - assertType(reaction.count); + expectType(reaction.count); reaction = await reaction.fetch(); } - assertType(reaction.count); - if (reaction.message.partial) return assertType(reaction.message.content); - assertType(reaction.message.content); + expectType(reaction.count); + if (reaction.message.partial) return expectType(reaction.message.content); + expectType(reaction.message.content); }); // Test interactions declare const interaction: Interaction; declare const booleanValue: boolean; -if (interaction.inGuild()) assertType(interaction.guildId); +if (interaction.inGuild()) expectType(interaction.guildId); client.on('interactionCreate', async interaction => { - assertType(interaction.guildId); if (interaction.inCachedGuild()) { - assertType(interaction.member); - // @ts-expect-error - assertType>(interaction); - assertType(interaction); + expectAssignable(interaction.member); + expectNotType>(interaction); + expectAssignable(interaction); } else if (interaction.inRawGuild()) { - assertType(interaction.member); - // @ts-expect-error - consumeCachedInteraction(interaction); + expectAssignable(interaction.member); + expectNotAssignable>(interaction); } else { - assertType(interaction.member); - // @ts-expect-error - consumeCachedInteraction(interaction); + expectType(interaction.member); + expectNotAssignable>(interaction); } if (interaction.isContextMenu()) { - assertType(interaction); + expectType(interaction); if (interaction.inCachedGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction); + expectAssignable(interaction); + expectAssignable(interaction.guild); + expectAssignable>(interaction); } else if (interaction.inRawGuild()) { - assertType(interaction); - assertType(interaction.guild); + expectAssignable(interaction); + expectType(interaction.guild); } else if (interaction.inGuild()) { - assertType(interaction); - assertType(interaction.guild); + expectAssignable(interaction); + expectType(interaction.guild); } } if (interaction.isButton()) { - assertType(interaction); + expectType(interaction); if (interaction.inCachedGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectAssignable>(interaction.reply({ fetchReply: true })); } else if (interaction.inRawGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } else if (interaction.inGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectAssignable(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } } if (interaction.isMessageComponent()) { - assertType(interaction); + expectType(interaction); if (interaction.inCachedGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectAssignable>(interaction.reply({ fetchReply: true })); } else if (interaction.inRawGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } else if (interaction.inGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } } if (interaction.isSelectMenu()) { - assertType(interaction); + expectType(interaction); if (interaction.inCachedGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>>(interaction.reply({ fetchReply: true })); } else if (interaction.inRawGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } else if (interaction.inGuild()) { - assertType(interaction); - assertType(interaction.guild); - assertType>(interaction.reply({ fetchReply: true })); + expectAssignable(interaction); + expectType(interaction.guild); + expectType>(interaction.reply({ fetchReply: true })); } } if (interaction.isCommand()) { if (interaction.inRawGuild()) { - // @ts-expect-error - consumeCachedCommand(interaction); - assertType(interaction); - assertType>(interaction.reply({ fetchReply: true })); - assertType(interaction.options.getMember('test')); - assertType(interaction.options.getMember('test', true)); + expectNotAssignable>(interaction); + expectAssignable(interaction); + expectType>(interaction.reply({ fetchReply: true })); + expectType(interaction.options.getMember('test')); + expectType(interaction.options.getMember('test', true)); - assertType(interaction.options.getChannel('test', true)); - assertType(interaction.options.getRole('test', true)); + expectType(interaction.options.getChannel('test', true)); + expectType(interaction.options.getRole('test', true)); } else if (interaction.inCachedGuild()) { const msg = await interaction.reply({ fetchReply: true }); const btn = await msg.awaitMessageComponent({ componentType: 'BUTTON' }); - assertType(msg); - assertType>(btn); + expectType>(msg); + expectType>(btn); - assertType>(interaction); - assertType(interaction.options.getMember('test', true)); - assertType(interaction.options.getMember('test')); - assertType(interaction); - assertType>(interaction.reply({ fetchReply: true })); + expectType(interaction.options.getMember('test')); + expectAssignable(interaction); + expectType>>(interaction.reply({ fetchReply: true })); - assertType(interaction.options.getChannel('test', true)); - assertType(interaction.options.getRole('test', true)); + expectType(interaction.options.getChannel('test', true)); + expectType(interaction.options.getRole('test', true)); } else { // @ts-expect-error consumeCachedCommand(interaction); - assertType(interaction); - assertType>(interaction.reply({ fetchReply: true })); - assertType(interaction.options.getMember('test')); - assertType(interaction.options.getMember('test', true)); + expectType(interaction); + expectType>(interaction.reply({ fetchReply: true })); + expectType(interaction.options.getMember('test')); + expectType(interaction.options.getMember('test', true)); - assertType( + expectType( interaction.options.getChannel('test', true), ); - assertType(interaction.options.getRole('test', true)); + expectType(interaction.options.getRole('test', true)); } - assertType(interaction); - assertType, 'getFocused' | 'getMessage'>>(interaction.options); - assertType(interaction.options.data); + expectType(interaction); + expectType, 'getFocused' | 'getMessage'>>(interaction.options); + expectType(interaction.options.data); const optionalOption = interaction.options.get('name'); const requiredOption = interaction.options.get('name', true); - assertType(optionalOption); - assertType(requiredOption); - assertType(requiredOption.options); + expectType(optionalOption); + expectType(requiredOption); + expectType(requiredOption.options); - assertType(interaction.options.getString('name', booleanValue)); - assertType(interaction.options.getString('name', false)); - assertType(interaction.options.getString('name', true)); + expectType(interaction.options.getString('name', booleanValue)); + expectType(interaction.options.getString('name', false)); + expectType(interaction.options.getString('name', true)); - assertType(interaction.options.getSubcommand()); - assertType(interaction.options.getSubcommand(true)); - assertType(interaction.options.getSubcommand(booleanValue)); - assertType(interaction.options.getSubcommand(false)); + expectType(interaction.options.getSubcommand()); + expectType(interaction.options.getSubcommand(true)); + expectType(interaction.options.getSubcommand(booleanValue)); + expectType(interaction.options.getSubcommand(false)); - assertType(interaction.options.getSubcommandGroup()); - assertType(interaction.options.getSubcommandGroup(true)); - assertType(interaction.options.getSubcommandGroup(booleanValue)); - assertType(interaction.options.getSubcommandGroup(false)); + expectType(interaction.options.getSubcommandGroup()); + expectType(interaction.options.getSubcommandGroup(true)); + expectType(interaction.options.getSubcommandGroup(booleanValue)); + expectType(interaction.options.getSubcommandGroup(false)); } }); declare const shard: Shard; shard.on('death', process => { - assertType(process); + expectType(process); }); declare const webSocketShard: WebSocketShard; webSocketShard.on('close', event => { - assertType(event); + expectType(event); }); declare const collector: Collector; collector.on('collect', (collected, ...other) => { - assertType(collected); - assertType(other); + expectType(collected); + expectType(other); }); collector.on('dispose', (vals, ...other) => { - assertType(vals); - assertType(other); + expectType(vals); + expectType(other); }); collector.on('end', (collection, reason) => { - assertType>(collection); - assertType(reason); + expectType>(collection); + expectType(reason); }); -assertType>(shard.eval(c => c.readyTimestamp)); +expectType>(shard.eval(c => c.readyTimestamp));