Files
NapCatQQ/packages/napcat-types/test-dist.ts
T
手瓜一十雪 b15d02535e refactor: minor lint and consistency fixes
Apply a collection of small code cleanups across the repo for consistency and lint-safety. Changes include:

- Use strict equality (===) where appropriate (GetEmojiLikes, about page checks).
- Replace Array.map used for side effects with Array.forEach (GetMsg).
- Rename unused catch parameters to underscore-prefixed names to avoid lint warnings (multiple backend/middleware files).
- Replace void with undefined in an actions.call invocation (builtin plugin index).
- Remove an unused loadedCount variable when reading .env (napcat-shell).
- Rename promise resolver parameter to `resolve` for clarity in tests and keep setTimeout usage (rpc.test.ts).
- Strengthen external shims types by changing generic parameter names to _T and update inversify ServiceIdentifier generic param (external-shims.d.ts).
- Simplify post-build script imports and comment out an external-type mapping block; fix a regex character class bug (post-build.mjs).
- Prefix several unused test stub variables with underscore to indicate intentional unused status (test-dist.ts).
- Minor JSX formatting/indentation fixes in password_login component and UI text indentation in system_info.
- Misc: SSE/config and plugin config handlers adjusted to consistent catch parameter naming; update mirror/download error catch variable name.

These edits are non-functional refactors focused on code style, lint compliance and small robustness/clarity improvements.
2026-03-05 18:53:58 +08:00

37 lines
1.1 KiB
TypeScript

import {
ChatType,
ElementType,
NapCatCore,
NTQQMsgApi,
NapCatOneBot11Adapter,
OB11Message,
OB11BaseMessageEvent,
OB11BaseMetaEvent,
} from './dist/napcat-types/index';
console.log('--- NapCat Comprehensive Type Test ---');
// 1. 测试枚举 (Core)
console.log('ChatType.KCHATTYPEGROUP:', ChatType.KCHATTYPEGROUP); // 应输出 2
console.log('ElementType.TEXT:', ElementType.TEXT); // 应输出 1
// 2. 测试类型 (Core)
const _coreStub = {} as NapCatCore;
const _apiStub = {} as NTQQMsgApi;
console.log('Core types access check: OK');
// 3. 测试类和类型 (OneBot)
const _obAdapterStub = {} as NapCatOneBot11Adapter;
const _obMsgStub = {} as OB11Message;
const _baseMessageEventStub = {} as OB11BaseMessageEvent;
const _baseMetaEventStub = {} as OB11BaseMetaEvent;
console.log('OneBot types and events access check: OK');
// 4. 验证导出完整性
if (ChatType.KCHATTYPEGROUP === 2 && ElementType.TEXT === 1) {
console.log('\n✅ ALL TESTS PASSED: Types, Enums and Events are correctly exported and accessible.');
} else {
console.error('\n❌ TESTS FAILED: Enum value mismatch.');
throw new Error('Test Failed');
}