mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Fix publish and sendToQueue signatures. (#41217)
As per the [documentation](https://github.com/benbria/node-amqp-connection-manager#amqpconnectionmanagercreatechanneloptions), the `content` field in `publish` and `sendToQueue` can be a plain object, when `createChannel`s `json` option is set. This commit extends the `content` parameter of those two functions. The change should be backwards compatible, as we're loosening requirements. Fixes #37295
This commit is contained in:
committed by
Ryan Cavanaugh
parent
533f14207e
commit
827e5dac59
@@ -24,6 +24,9 @@ channelWrapper.sendToQueue("foo", Buffer.from("bar"))
|
||||
// nothing
|
||||
});
|
||||
|
||||
// Test that plain objects are implicitly serialized.
|
||||
channelWrapper.sendToQueue("foo", {a: 'bar'}).catch(_ => {});
|
||||
|
||||
// Checking connection options
|
||||
amqpConMgr.connect(["foo", "bar"], {
|
||||
findServers(callback) {
|
||||
|
||||
5
types/amqp-connection-manager/index.d.ts
vendored
5
types/amqp-connection-manager/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for amqp-connection-manager 2.0
|
||||
// Project: https://github.com/benbria/node-amqp-connection-manager
|
||||
// Definitions by: rogierschouten <https://github.com/rogierschouten>
|
||||
// tstelzer <https://github.com/tstelzer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.2
|
||||
|
||||
@@ -158,7 +159,7 @@ export interface ChannelWrapper extends EventEmitter {
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>;
|
||||
publish(exchange: string, routingKey: string, content: Buffer | object, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* @see amqplib
|
||||
@@ -167,7 +168,7 @@ export interface ChannelWrapper extends EventEmitter {
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>;
|
||||
sendToQueue(queue: string, content: Buffer | object, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* @see amqplib
|
||||
|
||||
Reference in New Issue
Block a user