diff --git a/.eslintrc b/.eslintrc index 7adb806a..14fb0748 100644 --- a/.eslintrc +++ b/.eslintrc @@ -76,6 +76,8 @@ "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "rules": { + "no-shadow": "off", + "@typescript-eslint/no-shadow": "warn", "node/no-unsupported-features/es-syntax": "off" } }, diff --git a/index.d.ts b/index.d.ts index 7b3307f7..1fd1eac9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -21,7 +21,9 @@ export type RegistryContentType = /** * Container for all registered metrics */ -export class Registry { +export class Registry< + BoundRegistryContentType extends RegistryContentType = PrometheusContentType, +> { /** * Get string representation for all metrics */ @@ -81,14 +83,14 @@ export class Registry { /** * Gets the Content-Type of the metrics for use in the response headers. */ - readonly contentType: RegistryContentType; + readonly contentType: BoundRegistryContentType; /** * Set the content type of a registry. Used to change between Prometheus and * OpenMetrics versions. * @param contentType The type of the registry */ - setContentType(contentType: RegistryContentType): void; + setContentType(contentType: BoundRegistryContentType): void; /** * Merge registers