Skip to content

Commit a238584

Browse files
committed
fix(sys-client): fix ide type declaration error
1 parent 4d3b03a commit a238584

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

packages/system-client/src/components/FunctionEditor/types/globals.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { response_type } from './response_type'
2-
import { websocket_type } from './websocket_type'
32

43
export const global_declare = `
54
${response_type}
6-
${websocket_type}
75
86
declare class FunctionConsole {
97
private _logs;

packages/system-client/src/components/FunctionEditor/types/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class ImportParser {
2626
}
2727

2828
/**
29-
* Ts 自动对引入依赖进行类型提示加载
29+
* Typescript 自动对引入依赖进行类型提示加载
3030
*/
3131
export class AutoImportTypings {
3232
_parser = new ImportParser()
@@ -62,8 +62,8 @@ export class AutoImportTypings {
6262
if (!this.isLoaded('axios')) { this.loadDeclaration('axios') }
6363
if (!this.isLoaded('cloud-function-engine')) { this.loadDeclaration('cloud-function-engine') }
6464
if (!this.isLoaded('mongodb')) { this.loadDeclaration('mongodb') }
65-
if (!this.isLoaded('ws')) { this.loadDeclaration('ws') }
6665
if (!this.isLoaded('@types/node')) { this.loadDeclaration('@types/node') }
66+
// if (!this.isLoaded('ws')) { this.loadDeclaration('ws') }
6767
}
6868

6969
/**
@@ -81,6 +81,7 @@ export class AutoImportTypings {
8181
* @returns
8282
*/
8383
async loadDeclaration(packageName) {
84+
if (this.isLoaded(packageName)) return
8485
try {
8586
const r = await loadPackageTypings(packageName).catch(err => console.error(err))
8687
if (r?.code) {

packages/system-client/src/components/FunctionEditor/types/websocket_type.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
export const websocket_type = `
33
// WebSocket socket.
4-
declare class WebSocket extends EventEmitter {
4+
declare class CloudWebSocket extends EventEmitter {
55
/** The connection is not yet open. */
66
static readonly CONNECTING: 0;
77
/** The connection is open and ready to communicate. */

0 commit comments

Comments
 (0)