diff --git a/packages/system-client/src/components/FunctionEditor/types/globals.js b/packages/system-client/src/components/FunctionEditor/types/globals.js index dc4f33546d..0d4ecd510f 100644 --- a/packages/system-client/src/components/FunctionEditor/types/globals.js +++ b/packages/system-client/src/components/FunctionEditor/types/globals.js @@ -1,9 +1,7 @@ import { response_type } from './response_type' -import { websocket_type } from './websocket_type' export const global_declare = ` ${response_type} -${websocket_type} declare class FunctionConsole { private _logs; diff --git a/packages/system-client/src/components/FunctionEditor/types/index.js b/packages/system-client/src/components/FunctionEditor/types/index.js index 967c7cd124..73ef029bf2 100644 --- a/packages/system-client/src/components/FunctionEditor/types/index.js +++ b/packages/system-client/src/components/FunctionEditor/types/index.js @@ -26,7 +26,7 @@ export class ImportParser { } /** - * Ts 自动对引入依赖进行类型提示加载 + * Typescript 自动对引入依赖进行类型提示加载 */ export class AutoImportTypings { _parser = new ImportParser() @@ -62,8 +62,8 @@ export class AutoImportTypings { if (!this.isLoaded('axios')) { this.loadDeclaration('axios') } if (!this.isLoaded('cloud-function-engine')) { this.loadDeclaration('cloud-function-engine') } if (!this.isLoaded('mongodb')) { this.loadDeclaration('mongodb') } - if (!this.isLoaded('ws')) { this.loadDeclaration('ws') } if (!this.isLoaded('@types/node')) { this.loadDeclaration('@types/node') } + // if (!this.isLoaded('ws')) { this.loadDeclaration('ws') } } /** @@ -81,6 +81,7 @@ export class AutoImportTypings { * @returns */ async loadDeclaration(packageName) { + if (this.isLoaded(packageName)) return try { const r = await loadPackageTypings(packageName).catch(err => console.error(err)) if (r?.code) { diff --git a/packages/system-client/src/components/FunctionEditor/types/websocket_type.js b/packages/system-client/src/components/FunctionEditor/types/websocket_type.js index 6a94f124d7..482e99c162 100644 --- a/packages/system-client/src/components/FunctionEditor/types/websocket_type.js +++ b/packages/system-client/src/components/FunctionEditor/types/websocket_type.js @@ -1,7 +1,7 @@ export const websocket_type = ` // WebSocket socket. -declare class WebSocket extends EventEmitter { +declare class CloudWebSocket extends EventEmitter { /** The connection is not yet open. */ static readonly CONNECTING: 0; /** The connection is open and ready to communicate. */