From 40fbcc8c28e1a177aeea2eba65068ed71cd5e54e Mon Sep 17 00:00:00 2001 From: Stefan Erichsen Date: Thu, 8 Feb 2018 15:53:09 +0100 Subject: [PATCH 1/2] Frame now implements Message as it should --- types/stompjs/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index 008b99b511..5cefa092a0 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -51,9 +51,14 @@ export interface Message { nack(headers?: {}): any; } -export class Frame { +export class Frame implements Message { + command: string; + headers: {}; + body: string; constructor(command: string, headers?: {}, body?: string); + ack(headers?: {}): any; + nack(headers?: {}): any; toString(): string; sizeOfUTF8(s: string): number; unmarshall(datas: any): any; From 81e9cfe692d45166f7349fcc0d550c0eea3e0441 Mon Sep 17 00:00:00 2001 From: Stefan Erichsen Date: Thu, 8 Feb 2018 16:00:55 +0100 Subject: [PATCH 2/2] added test and my name --- types/stompjs/index.d.ts | 3 +-- types/stompjs/stompjs-tests.ts | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index 5cefa092a0..7d819f4352 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for stompjs 2.3 // Project: https://github.com/jmesnil/stomp-websocket -// Definitions by: Jimi Charalampidis +// Definitions by: Jimi Charalampidis , Stefan Erichsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -13,7 +13,6 @@ export const VERSIONS: { }; export class Client { - connected: boolean; counter: number; heartbeat: { diff --git a/types/stompjs/stompjs-tests.ts b/types/stompjs/stompjs-tests.ts index 15331fc81f..5d6eb1d0a5 100644 --- a/types/stompjs/stompjs-tests.ts +++ b/types/stompjs/stompjs-tests.ts @@ -43,6 +43,11 @@ client.connect('user', 'pass', () => { }, (error) => { }); client.connect('user', 'pass', () => { }, (error) => { }, 'host'); client.connect('user', 'pass', (frame) => { }, (error) => { }); client.connect('user', 'pass', (frame) => { }, (error) => { }, 'host'); +client.connect('user', 'pass', (frame) => { + if (!!frame) { + frame.command; + } + }, (error) => { }, 'host'); client.disconnect(() => { }); client.disconnect(() => { }, {});