The 2 JavaScript implementation of the Node methods, createSubscription() and createService() overload their options parameter such that it can either be an Options type or a callcaback function. The TypeScript declaration does not support this convenience. Therefore, I propose we added overloaded definitions for these 2 methods. The change will be similar to this:
// The new overloaded declaration that omits the options parameter
createSubscription<T extends TypeClass<MessageTypeClassName>>(
typeClass: T,
topic: string,
callback: SubscriptionCallback<T>
): Subscription;
// The current declaration will remain as:
createSubscription<T extends TypeClass<MessageTypeClassName>>(
typeClass: T,
topic: string,
options: Options,
callback: SubscriptionCallback<T>
): Subscription;
// The new overloaded declaration that omits the options parameter
createService<T extends TypeClass<ServiceTypeClassName>>(
typeClass: T,
serviceName: string,
callback: ServiceRequestHandler<T>
): ServiceType<T>;
// The current declaration will remain as:
createService<T extends TypeClass<ServiceTypeClassName>>(
typeClass: T,
serviceName: string,
options: Options,
callback: ServiceRequestHandler<T>
): ServiceType<T>;
The 2 JavaScript implementation of the Node methods,
createSubscription()
andcreateService()
overload theiroptions
parameter such that it can either be an Options type or a callcaback function. The TypeScript declaration does not support this convenience. Therefore, I propose we added overloaded definitions for these 2 methods. The change will be similar to this: