mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 13:10:16 +08:00
Update type declarations and remove ts-ignore comments
Added 'types' field to package.json and updated tsconfig.json to include .d.ts files for better type support in napcat-pty. Removed unnecessary @ts-ignore comments from terminal_manager.ts to improve code clarity.
This commit is contained in:
parent
bc183ae002
commit
8bc8df32f9
@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
|
"types": "node-pty.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./index.ts"
|
"import": "./index.ts"
|
||||||
|
|||||||
@ -40,7 +40,9 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
"**/*.ts"
|
"*.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import { AuthHelper } from '../helper/SignToken';
|
|||||||
import { LogWrapper } from 'napcat-common/src/log';
|
import { LogWrapper } from 'napcat-common/src/log';
|
||||||
import { WebSocket, WebSocketServer } from 'ws';
|
import { WebSocket, WebSocketServer } from 'ws';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
// @ts-ignore
|
|
||||||
import { IPty, spawn as ptySpawn } from 'napcat-pty';
|
import { IPty, spawn as ptySpawn } from 'napcat-pty';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
|
|
||||||
@ -136,7 +135,6 @@ class TerminalManager {
|
|||||||
isClosing: false,
|
isClosing: false,
|
||||||
buffer: '', // 初始化终端内容缓存
|
buffer: '', // 初始化终端内容缓存
|
||||||
};
|
};
|
||||||
// @ts-ignore
|
|
||||||
pty.onData((data: any) => {
|
pty.onData((data: any) => {
|
||||||
// 追加数据到 buffer
|
// 追加数据到 buffer
|
||||||
instance.buffer += data;
|
instance.buffer += data;
|
||||||
@ -147,7 +145,6 @@ class TerminalManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// @ts-ignore
|
|
||||||
pty.onExit(() => {
|
pty.onExit(() => {
|
||||||
this.closeTerminal(id);
|
this.closeTerminal(id);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user