digikare / nestjs-prom

A prometheus module for nestjs
160 stars 54 forks source link

Compiler Type-Checking errors #20

Open xxluke opened 4 years ago

xxluke commented 4 years ago

Hi,

the compiler outputs some errors for this library, so it's not possible to use it when your CI/CD contains type checking.

> tsc --noEmit

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:10:7 - error TS2314: Generic type 'Metric' requires 1 type argument(s).

10 }) => client.Metric;
         ~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:15:7 - error TS2314: Generic type 'Counter<T>' requires 1 type argument(s).

15 }) => client.Counter;
         ~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:20:7 - error TS2314: Generic type 'Gauge<T>' requires 1 type argument(s).

20 }) => client.Gauge;
         ~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:25:7 - error TS2314: Generic type 'Histogram<T>' requires 1 type argument(s).

25 }) => client.Histogram;
         ~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/common/prom.utils.d.ts:30:7 - error TS2314: Generic type 'Summary<T>' requires 1 type argument(s).

30 }) => client.Summary;
         ~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:4:44 - error TS2314: Generic type 'Counter<T>' requires 1 type argument(s).

4 export declare class CounterMetric extends PromClient.Counter {
                                             ~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:6:42 - error TS2314: Generic type 'Gauge<T>' requires 1 type argument(s).

6 export declare class GaugeMetric extends PromClient.Gauge {
                                           ~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:8:46 - error TS2314: Generic type 'Histogram<T>' requires 1 type argument(s).

8 export declare class HistogramMetric extends PromClient.Histogram {
                                               ~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/index.d.ts:10:44 - error TS2314: Generic type 'Summary<T>' requires 1 type argument(s).

10 export declare class SummaryMetric extends PromClient.Summary {
                                              ~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:14:20 - error TS2314: Generic type 'CounterConfiguration<T>' requires 1 type argument(s).

14     configuration: PromClient.CounterConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:18:20 - error TS2314: Generic type 'GaugeConfiguration<T>' requires 1 type argument(s).

18     configuration: PromClient.GaugeConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:22:20 - error TS2314: Generic type 'HistogramConfiguration<T>' requires 1 type argument(s).

22     configuration: PromClient.HistogramConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/interfaces/metric.type.d.ts:26:20 - error TS2314: Generic type 'SummaryConfiguration<T>' requires 1 type argument(s).

26     configuration: PromClient.SummaryConfiguration;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:7:38 - error TS2314: Generic type 'CounterConfiguration<T>' requires 1 type argument(s).

7     static forCounter(configuration: client.CounterConfiguration): DynamicModule;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:8:36 - error TS2314: Generic type 'GaugeConfiguration<T>' requires 1 type argument(s).

8     static forGauge(configuration: client.GaugeConfiguration): DynamicModule;
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:9:40 - error TS2314: Generic type 'HistogramConfiguration<T>' requires 1 type argument(s).

9     static forHistogram(configuration: client.HistogramConfiguration): DynamicModule;
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@digikare/nestjs-prom/dist/prom.module.d.ts:10:38 - error TS2314: Generic type 'SummaryConfiguration<T>' requires 1 type argument(s).

10     static forSummary(configuration: client.SummaryConfiguration): DynamicModule;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 17 errors.
xxluke commented 4 years ago

A workaround is to use the skipLibCheck option, like this: tsc --noEmit --skipLibCheck

jakubknejzlik commented 4 years ago

More appropriate solution would be to use specific prom-client version prom-client@11.5.2 as v12 has breaking changes (https://github.com/siimon/prom-client/releases/tag/v12.0.0). I also suggest renaming this issue to "Add support for prom-client v12" or something similar :)

royi-frontegg commented 4 years ago

This is actually quite an important issue and should be documented in README

spike008t commented 4 years ago

Hey, sorry for the delay, and that's right that should be documented. To avoid any issue with that kind of stuff, I will set prom-client as dependency instead of devDependency...

jakubknejzlik commented 4 years ago

Hi @spike008t, are You sure that aiming to "prom-client": "^12.0.0" is correct? If I'm not mistaken, the v12 has breaking changes and this library works prom-client@11.5.2 (see my previous comment)

spike008t commented 4 years ago

Is it actually the case with the v1.0.0?