mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
build: Properly add typecheck tests (#10722)
* build: exclude type tests from running * refactor: use `tsc` * test: fix broker test * test: fix voice test * test: fix builders test * test: use vitest typecheck remove unused test scripts skip lib check rm vitest.d.ts * fix: remove tsd from core and ws * fix: extend local tsconfig --------- Co-authored-by: almeidx <github@almeidx.dev> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
import type { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
||||
import { expectType, expectAssignable } from 'tsd';
|
||||
import { expectTypeOf } from 'vitest';
|
||||
import type { ManagerShardEventsMap, WebSocketShardEventsMap, WebSocketManager } from '../../src/index.js';
|
||||
|
||||
declare const manager: WebSocketManager;
|
||||
declare const eventMap: ManagerShardEventsMap;
|
||||
|
||||
type AugmentedShardEventsMap = {
|
||||
[K in keyof WebSocketShardEventsMap]: [
|
||||
WebSocketShardEventsMap[K] extends [] ? { shardId: number } : WebSocketShardEventsMap[K][0] & { shardId: number },
|
||||
];
|
||||
[K in keyof WebSocketShardEventsMap]: [...WebSocketShardEventsMap[K], shardId: number];
|
||||
};
|
||||
|
||||
expectType<AugmentedShardEventsMap>(eventMap);
|
||||
expectAssignable<AsyncEventEmitter<AugmentedShardEventsMap>>(manager);
|
||||
expectTypeOf(eventMap).toEqualTypeOf<AugmentedShardEventsMap>();
|
||||
expectTypeOf(manager).toMatchTypeOf<AsyncEventEmitter<AugmentedShardEventsMap>>();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "2.0.0",
|
||||
"description": "Wrapper around Discord's gateway",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test": "vitest run --config ../../vitest.config.ts",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
@@ -96,7 +96,6 @@
|
||||
"eslint-formatter-pretty": "^6.0.1",
|
||||
"mock-socket": "^9.3.1",
|
||||
"prettier": "^3.4.2",
|
||||
"tsd": "^0.31.2",
|
||||
"tsup": "^8.3.5",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "~5.5.4",
|
||||
|
||||
10
packages/ws/tsconfig.test.json
Normal file
10
packages/ws/tsconfig.test.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["__tests__/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user