Skip to content

Commit

Permalink
fix(sys-client): fix ide type declaration error
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Nov 9, 2021
1 parent 4d3b03a commit a238584
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ImportParser {
}

/**
* Ts 自动对引入依赖进行类型提示加载
* Typescript 自动对引入依赖进行类型提示加载
*/
export class AutoImportTypings {
_parser = new ImportParser()
Expand Down Expand Up @@ -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') }
}

/**
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down

0 comments on commit a238584

Please sign in to comment.