Skip to content

Commit

Permalink
Update pushgateway type def (#469)
Browse files Browse the repository at this point in the history
* Update pushgateway type def

Update pushgateway typedef to reflect javascript implementation

* Update index.d.ts

Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>

* pr feedback

* add tsd check

* Revert "add tsd check"

This reverts commit 0d591f9.

* update change log

* typo

Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
  • Loading branch information
adilhafeez and SimenB committed Sep 30, 2021
1 parent 5c1c68e commit 1821651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- changed: typedef for pushgateway to reflect js implementation.

Pushgateway's typedef were missing promise return type. That was
causing vscode to think that push/pushAdd and delete didn't promise
resulting in incorrect behavior.

### Added

## [14.0.0] - 2021-09-18
Expand Down
12 changes: 3 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,32 +557,26 @@ export class Pushgateway {
/**
* Add metric and overwrite old ones
* @param params Push parameters
* @param callback Callback when request is complete
*/
pushAdd(
params: Pushgateway.Parameters,
callback: (error?: Error, httpResponse?: any, body?: any) => void,
): void;
): Promise<{ resp?: unknown, body?: unknown }>;

/**
* Overwrite all metric (using PUT to Pushgateway)
* @param params Push parameters
* @param callback Callback when request is complete
*/
push(
params: Pushgateway.Parameters,
callback: (error?: Error, httpResponse?: any, body?: any) => void,
): void;
): Promise<{ resp?: unknown, body?: unknown }>;

/**
* Delete all metrics for jobName
* @param params Push parameters
* @param callback Callback when request is complete
*/
delete(
params: Pushgateway.Parameters,
callback: (error?: Error, httpResponse?: any, body?: any) => void,
): void;
): Promise<{ resp?: unknown, body?: unknown }>;
}

export namespace Pushgateway {
Expand Down

0 comments on commit 1821651

Please sign in to comment.