From 2e6ad68151652117ed55ab304d7fa2c7009d0388 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Fri, 22 Nov 2024 19:33:17 +0200 Subject: [PATCH] chore: bye tsd --- package-lock.json | 828 ------------------ package.json | 5 +- tests/__utils__/type-assertions.ts | 6 + tests/tsconfig.json | 8 + tests/v10/channel.test-d.ts | 50 -- tests/v10/channel.ts | 59 ++ tests/v10/chatInputOptions.test-d.ts | 63 -- tests/v10/chatInputOptions.ts | 79 ++ tests/v10/interactions.test-d.ts | 58 -- tests/v10/interactions.ts | 57 ++ tests/v10/messageCreate.test-d.ts | 6 - tests/v10/messageCreate.ts | 6 + tests/v10/{oauth2.test-d.ts => oauth2.ts} | 17 +- .../{onboarding.test-d.ts => onboarding.ts} | 2 +- tests/v10/{routes.test-d.ts => routes.ts} | 2 +- tests/v9/{oauth2.test-d.ts => oauth2.ts} | 14 +- tests/v9/{routes.test-d.ts => routes.ts} | 2 +- 17 files changed, 237 insertions(+), 1025 deletions(-) create mode 100644 tests/__utils__/type-assertions.ts create mode 100644 tests/tsconfig.json delete mode 100644 tests/v10/channel.test-d.ts create mode 100644 tests/v10/channel.ts delete mode 100644 tests/v10/chatInputOptions.test-d.ts create mode 100644 tests/v10/chatInputOptions.ts delete mode 100644 tests/v10/interactions.test-d.ts create mode 100644 tests/v10/interactions.ts delete mode 100644 tests/v10/messageCreate.test-d.ts create mode 100644 tests/v10/messageCreate.ts rename tests/v10/{oauth2.test-d.ts => oauth2.ts} (74%) rename tests/v10/{onboarding.test-d.ts => onboarding.ts} (91%) rename tests/v10/{routes.test-d.ts => routes.ts} (76%) rename tests/v9/{oauth2.test-d.ts => oauth2.ts} (72%) rename tests/v9/{routes.test-d.ts => routes.ts} (76%) diff --git a/package-lock.json b/package-lock.json index dc68ffc7..0b57e879 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,6 @@ "prettier": "^3.2.5", "pretty-quick": "^4.0.0", "rimraf": "^6.0.0", - "tsd": "^0.31.2", "tsutils": "^3.21.0", "typescript": "^5.6.3" } @@ -1113,19 +1112,6 @@ "node": ">=18.0.0" } }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@sinclair/typebox": "^0.27.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -1820,13 +1806,6 @@ "node": ">=v14.0.0" } }, - "node_modules/@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true, - "license": "MIT" - }, "node_modules/@thisismanta/pessimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@thisismanta/pessimist/-/pessimist-1.2.0.tgz", @@ -1840,16 +1819,6 @@ "node": ">=16.0.0" } }, - "node_modules/@tsd/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-saiCxzHRhUrRxQV2JhH580aQUZiKQUXI38FcAcikcfOomAil4G4lxT0RfrrKywoAYP/rqAdYXYmNRLppcd+hQQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.17" - } - }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", @@ -1928,17 +1897,6 @@ "@types/ms": "*" } }, - "node_modules/@types/eslint": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", - "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -2007,13 +1965,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/ms": { "version": "0.7.34", "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", @@ -3044,16 +2995,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/assert": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.1.tgz", @@ -3405,34 +3346,6 @@ "node": ">=6" } }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", - "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^5.3.1", - "map-obj": "^4.0.0", - "quick-lru": "^4.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001683", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001683.tgz", @@ -4273,43 +4186,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "license": "MIT", - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decamelize-keys/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/decode-named-character-reference": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", @@ -4412,16 +4288,6 @@ "node": ">=0.3.1" } }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -4916,123 +4782,6 @@ "typescript": ">=4.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, - "license": "MIT", - "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-formatter-pretty/node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/eslint-formatter-pretty/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-formatter-pretty/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint-import-resolver-node": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", @@ -5985,13 +5734,6 @@ "eslint": "^6.2.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" } }, - "node_modules/eslint-rule-docs": { - "version": "1.1.235", - "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.235.tgz", - "integrity": "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A==", - "dev": true, - "license": "MIT" - }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -6892,16 +6634,6 @@ "uglify-js": "^3.1.4" } }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -7204,16 +6936,6 @@ "node": ">= 12" } }, - "node_modules/irregular-plurals": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", - "integrity": "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-alphabetical": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", @@ -7725,19 +7447,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "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, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-valid-identifier": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-valid-identifier/-/is-valid-identifier-2.0.2.tgz", @@ -7841,65 +7550,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, "node_modules/jiti": { "version": "1.21.6", "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.6.tgz", @@ -8062,16 +7712,6 @@ "json-buffer": "3.0.1" } }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -8355,56 +7995,6 @@ "dev": true, "license": "MIT" }, - "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, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-symbols/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/log-symbols/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/log-update": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", @@ -8584,19 +8174,6 @@ "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/mdast-util-from-markdown": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", @@ -10022,31 +9599,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "license": "MIT", - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/minimist-options/node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/minipass": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", @@ -10939,22 +10491,6 @@ "node": ">=0.10" } }, - "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, - "license": "MIT", - "dependencies": { - "irregular-plurals": "^3.2.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", @@ -11044,41 +10580,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/pretty-format/node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "dev": true, - "license": "MIT" - }, "node_modules/pretty-quick": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-4.0.0.tgz", @@ -11409,16 +10910,6 @@ ], "license": "MIT" }, - "node_modules/quick-lru": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", - "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -11598,20 +11089,6 @@ "node": ">= 6" } }, - "node_modules/redent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", - "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^4.0.0", - "strip-indent": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/reflect.getprototypeof": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz", @@ -12876,20 +12353,6 @@ "node": ">=8" } }, - "node_modules/supports-hyperlinks": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", - "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -13021,16 +12484,6 @@ "node": ">=8.0" } }, - "node_modules/trim-newlines": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", - "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/trough": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", @@ -13055,287 +12508,6 @@ "typescript": ">=4.2.0" } }, - "node_modules/tsd": { - "version": "0.31.2", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.31.2.tgz", - "integrity": "sha512-VplBAQwvYrHzVihtzXiUVXu5bGcr7uH1juQZ1lmKgkuGNGT+FechUCqmx9/zk7wibcqR2xaNEwCkDyKh+VVZnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@tsd/typescript": "~5.4.3", - "eslint-formatter-pretty": "^4.1.0", - "globby": "^11.0.1", - "jest-diff": "^29.0.3", - "meow": "^9.0.0", - "path-exists": "^4.0.0", - "read-pkg-up": "^7.0.0" - }, - "bin": { - "tsd": "dist/cli.js" - }, - "engines": { - "node": ">=14.16" - } - }, - "node_modules/tsd/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "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, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "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, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "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, - "license": "MIT", - "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/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "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, - "license": "MIT", - "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, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "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, - "license": "MIT", - "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, - "license": "MIT", - "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, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/tsd/node_modules/read-pkg/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true, - "license": "ISC" - }, - "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, - "license": "BSD-2-Clause", - "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/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "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, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "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, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tsd/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, - "node_modules/tsd/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", diff --git a/package.json b/package.json index 42f32254..76212e40 100644 --- a/package.json +++ b/package.json @@ -112,9 +112,7 @@ "prepare": "tsc -p ./.eslint-plugin-local && (is-ci || husky)", "prepublishOnly": "run-s clean test:lint build:node", "test:lint": "prettier --check . && eslint --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"", - "pretest:types": "tsc", - "test:types": "tsd -t ./v10.d.ts && tsd -t ./v9.d.ts", - "posttest:types": "npm run clean:node" + "test:types": "tsc -p tests" }, "keywords": [ "discord", @@ -152,7 +150,6 @@ "prettier": "^3.2.5", "pretty-quick": "^4.0.0", "rimraf": "^6.0.0", - "tsd": "^0.31.2", "tsutils": "^3.21.0", "typescript": "^5.6.3" }, diff --git a/tests/__utils__/type-assertions.ts b/tests/__utils__/type-assertions.ts new file mode 100644 index 00000000..1fc3f192 --- /dev/null +++ b/tests/__utils__/type-assertions.ts @@ -0,0 +1,6 @@ +export declare function expectAssignable(input: T): void; + +// TODO: no clue if this is correct +export declare function expectNotAssignable( + input: Actual extends Expected ? never : Expected, +): void; diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 00000000..b3cabbdd --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": ["../tsconfig.json"], + "compilerOptions": { + "noEmit": true, + "noUnusedLocals": false + }, + "include": ["./**/*.ts"] +} diff --git a/tests/v10/channel.test-d.ts b/tests/v10/channel.test-d.ts deleted file mode 100644 index 497157b1..00000000 --- a/tests/v10/channel.test-d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { expectType, expectAssignable, expectNotAssignable, expectError } from 'tsd'; -import type { - ChannelType, - APIPartialChannel, - APIGroupDMChannel, - APIDMChannel, - APIGuildChannel, - APITextChannel, - APIThreadChannel, - APIGuildVoiceChannel, - APIGuildStageVoiceChannel, -} from '../../v10'; - -type AnyGuildChannel = APIGuildChannel; - -declare const partialChannel: APIPartialChannel; -declare const dmChannel: APIDMChannel; -declare const groupDMChannel: APIGroupDMChannel; -declare const guildChannel: AnyGuildChannel; -declare const guildTextChannel: APITextChannel; -declare const guildThreadChannel: APIThreadChannel; -declare const guildVoiceChannel: APIGuildVoiceChannel; -declare const guildVoiceStageChannel: APIGuildStageVoiceChannel; - -// Make sure types follow expected hierarchy -expectNotAssignable(dmChannel); -expectNotAssignable(groupDMChannel); -expectAssignable(guildTextChannel); -expectAssignable(guildThreadChannel); -expectAssignable(guildVoiceChannel); -expectAssignable(guildVoiceStageChannel); - -// Test channel names are properly typed -// Always non-null present for non-DM channels, always null for DM channel -expectType(partialChannel.name); -expectType(groupDMChannel.name); -expectType(dmChannel.name); -expectType(guildChannel.name); - -// Test last pin timestamp -expectType(dmChannel.last_pin_timestamp); -expectType(groupDMChannel.last_pin_timestamp); -expectType(guildTextChannel.last_pin_timestamp); -expectType(guildThreadChannel.last_pin_timestamp); -expectError(guildVoiceChannel.last_pin_timestamp); -expectError(guildVoiceStageChannel.last_pin_timestamp); - -// Test rate limit types -expectType(guildTextChannel.default_thread_rate_limit_per_user); -expectError(guildVoiceChannel.default_thread_rate_limit_per_user); diff --git a/tests/v10/channel.ts b/tests/v10/channel.ts new file mode 100644 index 00000000..8a96b6ea --- /dev/null +++ b/tests/v10/channel.ts @@ -0,0 +1,59 @@ +import type { + ChannelType, + APIPartialChannel, + APIGroupDMChannel, + APIDMChannel, + APIGuildChannel, + APITextChannel, + APIThreadChannel, + APIGuildVoiceChannel, + APIGuildStageVoiceChannel, +} from '../../v10'; +import { expectAssignable, expectNotAssignable } from '../__utils__/type-assertions'; + +type AnyGuildChannel = APIGuildChannel; + +declare const partialChannel: APIPartialChannel; +declare const dmChannel: APIDMChannel; +declare const groupDMChannel: APIGroupDMChannel; +declare const guildChannel: AnyGuildChannel; +declare const guildTextChannel: APITextChannel; +declare const guildThreadChannel: APIThreadChannel; +declare const guildVoiceChannel: APIGuildVoiceChannel; +declare const guildVoiceStageChannel: APIGuildStageVoiceChannel; + +// Make sure types follow expected hierarchy +// @ts-expect-error - dmChannel is not assignable to AnyGuildChannel +expectNotAssignable(dmChannel); +// @ts-expect-error - groupDMChannel is not assignable to AnyGuildChannel +expectNotAssignable(groupDMChannel); +expectAssignable(guildTextChannel); +expectAssignable(guildThreadChannel); +expectAssignable(guildVoiceChannel); +expectAssignable(guildVoiceStageChannel); + +// Test channel names are properly typed +// Always non-null present for non-DM channels, always null for DM channel +expectAssignable(partialChannel.name); +expectAssignable(groupDMChannel.name); +expectAssignable(dmChannel.name); +expectAssignable(guildChannel.name); + +// Test last pin timestamp +expectAssignable(dmChannel.last_pin_timestamp); +expectAssignable(groupDMChannel.last_pin_timestamp); +expectAssignable(guildTextChannel.last_pin_timestamp); +expectAssignable(guildThreadChannel.last_pin_timestamp); + +let _: any; + +// @ts-expect-error - last_pin_timestamp does not exist on this channel type +_ = guildVoiceChannel.last_pin_timestamp; +// @ts-expect-error - last_pin_timestamp does not exist on this channel type +_ = guildVoiceStageChannel.last_pin_timestamp; + +// Test rate limit types +expectAssignable(guildTextChannel.default_thread_rate_limit_per_user); + +// @ts-expect-error - default_thread_rate_limit_per_user does not exist on this channel type +_ = guildVoiceChannel.default_thread_rate_limit_per_user; diff --git a/tests/v10/chatInputOptions.test-d.ts b/tests/v10/chatInputOptions.test-d.ts deleted file mode 100644 index aee0ee5b..00000000 --- a/tests/v10/chatInputOptions.test-d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expectAssignable, expectNotAssignable, expectNotType } from 'tsd'; -import { - APIApplicationCommandIntegerOption, - APIApplicationCommandNumberOption, - APIApplicationCommandOption, - APIApplicationCommandStringOption, - ApplicationCommandOptionType, -} from '../../v10'; - -const baseValues = { - name: 'test', - description: 'test', -}; - -expectAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.String, - autocomplete: true, -}); - -expectAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.Integer, - autocomplete: true, -}); - -expectAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.Number, - autocomplete: true, -}); - -expectNotType({ - ...baseValues, - type: ApplicationCommandOptionType.String, - choices: [], -}); - -expectNotAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.String, - choices: [], - autocomplete: true, -}); - -expectAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.String, - choices: [], - autocomplete: false, -}); - -expectAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.Number, - choices: [], -}); - -expectNotAssignable({ - ...baseValues, - type: ApplicationCommandOptionType.Boolean, - autocomplete: true, -}); diff --git a/tests/v10/chatInputOptions.ts b/tests/v10/chatInputOptions.ts new file mode 100644 index 00000000..aa28ba4a --- /dev/null +++ b/tests/v10/chatInputOptions.ts @@ -0,0 +1,79 @@ +import type { + APIApplicationCommandIntegerOption, + APIApplicationCommandNumberOption, + APIApplicationCommandOption, + APIApplicationCommandStringOption, +} from '../../v10'; +import { ApplicationCommandOptionType } from '../../v10'; + +const baseValues = { + name: 'test', + description: 'test', +}; + +{ + const option: APIApplicationCommandStringOption = { + ...baseValues, + type: ApplicationCommandOptionType.String, + autocomplete: true, + }; +} + +{ + const option: APIApplicationCommandIntegerOption = { + ...baseValues, + type: ApplicationCommandOptionType.Integer, + autocomplete: true, + }; +} + +{ + const option: APIApplicationCommandNumberOption = { + ...baseValues, + type: ApplicationCommandOptionType.Number, + autocomplete: true, + }; +} + +{ + const option: APIApplicationCommandStringOption = { + ...baseValues, + type: ApplicationCommandOptionType.String, + choices: [], + }; +} + +{ + const option: APIApplicationCommandStringOption = { + ...baseValues, + type: ApplicationCommandOptionType.String, + choices: [], + autocomplete: true, + }; +} + +{ + const option: APIApplicationCommandStringOption = { + ...baseValues, + type: ApplicationCommandOptionType.String, + choices: [], + autocomplete: false, + }; +} + +{ + const option: APIApplicationCommandNumberOption = { + ...baseValues, + type: ApplicationCommandOptionType.Number, + choices: [], + }; +} + +{ + const option: APIApplicationCommandOption = { + ...baseValues, + type: ApplicationCommandOptionType.Boolean, + // @ts-expect-error - autocomplete is not allowed on booleans + autocomplete: true, + }; +} diff --git a/tests/v10/interactions.test-d.ts b/tests/v10/interactions.test-d.ts deleted file mode 100644 index 65fac64a..00000000 --- a/tests/v10/interactions.test-d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { expectType } from 'tsd'; -import type { Snowflake } from '../../globals'; -import { - APIApplicationCommandAutocompleteInteraction, - APIApplicationCommandInteraction, - APIApplicationCommandInteractionData, - APIDMInteraction, - APIGuildInteraction, - APIInteraction, - APIInteractionGuildMember, - APIMessageComponentInteraction, - APIModalSubmission, - APIUser, - ComponentType, - InteractionType, -} from '../../v10'; - -declare const interaction: APIInteraction; - -if (interaction.type === InteractionType.ApplicationCommand) { - expectType(interaction); - - const { data } = interaction; - expectType(data); - expectType(data.guild_id); -} - -if (interaction.type === InteractionType.MessageComponent) { - expectType(interaction); - - const { data } = interaction; - if (data.component_type === ComponentType.Button) { - // TODO: For some reason, tsd yields a `Parameter type APIMessageButtonInteractionData is not identical to argument type APIMessageButtonInteractionData.` error - // expectType(data); - } - - if (data.component_type === ComponentType.StringSelect) { - // TODO: for some reason, tsd yields a `Parameter type APIMessageSelectMenuInteractionData is not identical to argument type APIMessageSelectMenuInteractionData.` error - // expectType(data); - expectType(data.values); - } -} - -if (interaction.type === InteractionType.ApplicationCommandAutocomplete) { - expectType(interaction.data); -} - -if (interaction.type === InteractionType.ModalSubmit) { - expectType(interaction.data); -} - -declare const dmInteraction: APIDMInteraction; - -expectType(dmInteraction.user); - -declare const guildInteraction: APIGuildInteraction; - -expectType(guildInteraction.member); diff --git a/tests/v10/interactions.ts b/tests/v10/interactions.ts new file mode 100644 index 00000000..3c0116ac --- /dev/null +++ b/tests/v10/interactions.ts @@ -0,0 +1,57 @@ +import type { Snowflake } from '../../globals'; +import type { + APIApplicationCommandAutocompleteInteraction, + APIApplicationCommandInteraction, + APIApplicationCommandInteractionData, + APIDMInteraction, + APIGuildInteraction, + APIInteraction, + APIInteractionGuildMember, + APIMessageButtonInteractionData, + APIMessageComponentInteraction, + APIMessageSelectMenuInteractionData, + APIModalSubmission, + APIUser, +} from '../../v10'; +import { ComponentType, InteractionType } from '../../v10'; +import { expectAssignable } from '../__utils__/type-assertions'; + +declare const interaction: APIInteraction; + +if (interaction.type === InteractionType.ApplicationCommand) { + expectAssignable(interaction); + + const { data } = interaction; + expectAssignable(data); + expectAssignable(data.guild_id); +} + +if (interaction.type === InteractionType.MessageComponent) { + expectAssignable(interaction); + + const { data } = interaction; + if (data.component_type === ComponentType.Button) { + expectAssignable(data); + } + + if (data.component_type === ComponentType.StringSelect) { + expectAssignable(data); + expectAssignable(data.values); + } +} + +if (interaction.type === InteractionType.ApplicationCommandAutocomplete) { + expectAssignable(interaction.data); +} + +if (interaction.type === InteractionType.ModalSubmit) { + expectAssignable(interaction.data); +} + +declare const dmInteraction: APIDMInteraction; + +expectAssignable(dmInteraction.user); + +declare const guildInteraction: APIGuildInteraction; + +expectAssignable(guildInteraction.member); diff --git a/tests/v10/messageCreate.test-d.ts b/tests/v10/messageCreate.test-d.ts deleted file mode 100644 index bc313f28..00000000 --- a/tests/v10/messageCreate.test-d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { expectError } from 'tsd'; -import { GatewayMessageCreateDispatch } from '../../v10'; - -declare const messageCreateDispatch: GatewayMessageCreateDispatch; - -expectError(messageCreateDispatch.d.member?.user); diff --git a/tests/v10/messageCreate.ts b/tests/v10/messageCreate.ts new file mode 100644 index 00000000..92d810fc --- /dev/null +++ b/tests/v10/messageCreate.ts @@ -0,0 +1,6 @@ +import type { GatewayMessageCreateDispatch } from '../../v10'; + +declare const messageCreateDispatch: GatewayMessageCreateDispatch; + +// @ts-expect-error - missing user +const _ = messageCreateDispatch.d.member?.user; diff --git a/tests/v10/oauth2.test-d.ts b/tests/v10/oauth2.ts similarity index 74% rename from tests/v10/oauth2.test-d.ts rename to tests/v10/oauth2.ts index 7ee7128e..b0991022 100644 --- a/tests/v10/oauth2.test-d.ts +++ b/tests/v10/oauth2.ts @@ -1,21 +1,24 @@ -import { expectAssignable, expectNotAssignable } from 'tsd'; import type { OAuth2Scopes, RESTOAuth2BotAuthorizationQuery, RESTOAuth2AdvancedBotAuthorizationQuery } from '../../v10'; +import { expectAssignable, expectNotAssignable } from '../__utils__/type-assertions'; declare const validBotScope: | OAuth2Scopes.Bot - | 'bot' - | 'bot identify' + | 'applications.commands bot identify' | 'applications.commands bot' - | 'applications.commands bot identify'; + | 'bot identify' + | 'bot'; + declare const invalidBotScope: | OAuth2Scopes.ApplicationsCommands - | 'applications.commands' + | '' | 'applications.commands identify' - | 'bot%20identify' - | ''; + | 'applications.commands' + | 'bot%20identify'; expectAssignable(validBotScope); +// @ts-expect-error - invalid scope expectNotAssignable(invalidBotScope); expectAssignable(validBotScope); +// @ts-expect-error - invalid scope expectNotAssignable(invalidBotScope); diff --git a/tests/v10/onboarding.test-d.ts b/tests/v10/onboarding.ts similarity index 91% rename from tests/v10/onboarding.test-d.ts rename to tests/v10/onboarding.ts index 3d061d9e..f1819708 100644 --- a/tests/v10/onboarding.test-d.ts +++ b/tests/v10/onboarding.ts @@ -1,5 +1,5 @@ -import { expectAssignable } from 'tsd'; import type { APIGuildOnboarding, RESTPutAPIGuildOnboardingJSONBody } from '../../v10'; +import { expectAssignable } from '../__utils__/type-assertions'; declare const onboarding: APIGuildOnboarding; diff --git a/tests/v10/routes.test-d.ts b/tests/v10/routes.ts similarity index 76% rename from tests/v10/routes.test-d.ts rename to tests/v10/routes.ts index b71e03e2..e9e911dd 100644 --- a/tests/v10/routes.test-d.ts +++ b/tests/v10/routes.ts @@ -1,5 +1,5 @@ -import { expectAssignable } from 'tsd'; import { CDNRoutes, Routes } from '../../rest/v10/index'; +import { expectAssignable } from '../__utils__/type-assertions'; expectAssignable `/${string}`>>(Routes); expectAssignable `/${string}`>>(CDNRoutes); diff --git a/tests/v9/oauth2.test-d.ts b/tests/v9/oauth2.ts similarity index 72% rename from tests/v9/oauth2.test-d.ts rename to tests/v9/oauth2.ts index 28553853..d5b613d0 100644 --- a/tests/v9/oauth2.test-d.ts +++ b/tests/v9/oauth2.ts @@ -1,20 +1,22 @@ -import { expectAssignable, expectNotAssignable } from 'tsd'; import type { OAuth2Scopes, RESTOAuth2BotAuthorizationQuery, RESTOAuth2AdvancedBotAuthorizationQuery } from '../../v9'; +import { expectAssignable, expectNotAssignable } from '../__utils__/type-assertions'; declare const validBotScope: | OAuth2Scopes.Bot - | 'bot' - | 'bot identify' + | 'applications.commands bot identify' | 'applications.commands bot' - | 'applications.commands bot identify'; + | 'bot identify' + | 'bot'; declare const invalidBotScope: | OAuth2Scopes.ApplicationsCommands - | 'applications.commands' + | '' | 'applications.commands identify' - | ''; + | 'applications.commands'; expectAssignable(validBotScope); +// @ts-expect-error - invalid scope expectNotAssignable(invalidBotScope); expectAssignable(validBotScope); +// @ts-expect-error - invalid scope expectNotAssignable(invalidBotScope); diff --git a/tests/v9/routes.test-d.ts b/tests/v9/routes.ts similarity index 76% rename from tests/v9/routes.test-d.ts rename to tests/v9/routes.ts index 36b93aa8..d294af0e 100644 --- a/tests/v9/routes.test-d.ts +++ b/tests/v9/routes.ts @@ -1,5 +1,5 @@ -import { expectAssignable } from 'tsd'; import { CDNRoutes, Routes } from '../../rest/v9/index'; +import { expectAssignable } from '../__utils__/type-assertions'; expectAssignable `/${string}`>>(Routes); expectAssignable `/${string}`>>(CDNRoutes);