From 75d6eb9895e94c56fe6312f30d00a3912143839f Mon Sep 17 00:00:00 2001 From: Victor Moukhortov Date: Fri, 9 Feb 2018 10:16:30 -0500 Subject: [PATCH 1/4] Update stompjs types Fix to correctly reflect actual library. --- types/stompjs/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index 008b99b511..d1c6696e56 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -26,7 +26,7 @@ export class Client { debug(...args: string[]): any; - connect(headers: { login: string, passcode: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; + connect(headers: { login?: string, passcode?: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; connect(login: string, passcode: string, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any, host?: string): any; disconnect(disconnectCallback: () => any, headers?: {}): any; @@ -56,8 +56,8 @@ export class Frame { toString(): string; sizeOfUTF8(s: string): number; - unmarshall(datas: any): any; - marshall(command: string, headers?: {}, body?: string): any; + static unmarshall(datas: any): any; + static marshall(command: string, headers?: {}, body?: string): any; } export function client(url: string, protocols?: string | Array): Client; From 0f0c24c3dbf49471aecbcdfc520929d08c8a8ccc Mon Sep 17 00:00:00 2001 From: Victor Moukhortov Date: Fri, 9 Feb 2018 11:01:36 -0500 Subject: [PATCH 2/4] fix: stompjs tests --- types/stompjs/stompjs-tests.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/types/stompjs/stompjs-tests.ts b/types/stompjs/stompjs-tests.ts index 15331fc81f..b9fb15cc7e 100644 --- a/types/stompjs/stompjs-tests.ts +++ b/types/stompjs/stompjs-tests.ts @@ -44,6 +44,11 @@ client.connect('user', 'pass', () => { }, (error) => { }, 'host'); client.connect('user', 'pass', (frame) => { }, (error) => { }); client.connect('user', 'pass', (frame) => { }, (error) => { }, 'host'); +client.connect({}, () => { }); +client.connect({}, () => { }, () => { }); +client.connect({}, () => { }, (error) => { }); +client.connect({}, (frame) => { }, (error) => { }); + client.disconnect(() => { }); client.disconnect(() => { }, {}); @@ -90,11 +95,11 @@ frame.toString(); frame.sizeOfUTF8('abc'); -frame.unmarshall(0); -frame.unmarshall('data'); -frame.unmarshall({}); -frame.unmarshall([{}, {}]); +Stomp.Frame.unmarshall(0); +Stomp.Frame.unmarshall('data'); +Stomp.Frame.unmarshall({}); +Stomp.Frame.unmarshall([{}, {}]); -frame.marshall('command'); -frame.marshall('command', {}); -frame.marshall('command', {}, 'body'); +Stomp.Frame.marshall('command'); +Stomp.Frame.marshall('command', {}); +Stomp.Frame.marshall('command', {}, 'body'); From bcc5bc34cb4d18fedb2e68ae3585c512b2fcffd6 Mon Sep 17 00:00:00 2001 From: Victor Moukhortov Date: Fri, 9 Feb 2018 11:05:39 -0500 Subject: [PATCH 3/4] fix: stompjs static Frame.sizeOfUTF8 --- types/stompjs/index.d.ts | 2 +- types/stompjs/stompjs-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index d1c6696e56..b1e48dab53 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -55,7 +55,7 @@ export class Frame { constructor(command: string, headers?: {}, body?: string); toString(): string; - sizeOfUTF8(s: string): number; + static sizeOfUTF8(s: string): number; static unmarshall(datas: any): any; static marshall(command: string, headers?: {}, body?: string): any; } diff --git a/types/stompjs/stompjs-tests.ts b/types/stompjs/stompjs-tests.ts index b9fb15cc7e..d745b09a4d 100644 --- a/types/stompjs/stompjs-tests.ts +++ b/types/stompjs/stompjs-tests.ts @@ -93,7 +93,7 @@ frame = new Stomp.Frame('command', {}, 'body'); frame.toString(); -frame.sizeOfUTF8('abc'); +Stomp.Frame.sizeOfUTF8('abc'); Stomp.Frame.unmarshall(0); Stomp.Frame.unmarshall('data'); From 352d74076ae4b1b93bd6320244790763d4efd16d Mon Sep 17 00:00:00 2001 From: Victor Moukhortov Date: Fri, 9 Feb 2018 15:39:49 -0500 Subject: [PATCH 4/4] fix: provide extra signature to connect --- types/stompjs/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index b1e48dab53..852119d814 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -26,7 +26,8 @@ export class Client { debug(...args: string[]): any; - connect(headers: { login?: string, passcode?: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; + connect(headers: { login: string, passcode: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; + connect(headers: { }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; connect(login: string, passcode: string, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any, host?: string): any; disconnect(disconnectCallback: () => any, headers?: {}): any;