From 874881be27329a68d3ad9da415d11e0dbe8f152c Mon Sep 17 00:00:00 2001 From: Alex Turek Date: Mon, 9 Oct 2017 15:46:03 -0700 Subject: [PATCH] [node-statsd] Add function overloads for `increment` (#20359) * [node-statsd] Add function overloads for increment * [node-statsd] Add a type test for the increment call --- types/node-statsd/index.d.ts | 2 ++ types/node-statsd/node-statsd-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/node-statsd/index.d.ts b/types/node-statsd/index.d.ts index bf44188c59..25c1adf47a 100644 --- a/types/node-statsd/index.d.ts +++ b/types/node-statsd/index.d.ts @@ -109,6 +109,8 @@ export class StatsD { * @param {Callback} callback Callback when message is done being delivered. Optional. */ increment(stat: string | string[], value?: number, sampleRate?: number, tags?: string[], callback?: Callback): void; + increment(stat: string | string[], value: any, sampleRateOrTags?: number | string [], callback?: Callback): void; + increment(stat: string | string[], value: any, callback?: Callback): void; /** * Sends a stat across the wire diff --git a/types/node-statsd/node-statsd-tests.ts b/types/node-statsd/node-statsd-tests.ts index e8212f229e..33cfa434c9 100644 --- a/types/node-statsd/node-statsd-tests.ts +++ b/types/node-statsd/node-statsd-tests.ts @@ -10,6 +10,8 @@ client.timing('response_time', 42); // Increment: Increments a stat by a value (default is 1) client.increment('my_counter'); +client.increment('my_counter', 1, ['foo:1', 'bar:abc']); + // Decrement: Decrements a stat by a value (default is -1) client.decrement('my_counter');