prom-client icon indicating copy to clipboard operation
prom-client copied to clipboard

MetricType enum not exported for use in index.js

Open biswa1shaw opened this issue 5 years ago • 3 comments

Using MetricType enum in typescript like MetricType.Counter gives error after transpilation

    type: prom_client_1.MetricType.Gauge
                                   ^
    TypeError: Cannot read property 'Gauge' of undefined

biswa1shaw avatar Feb 23 '20 16:02 biswa1shaw

That's a pair of bug in the TypeScript definitions (there is no such object to go along with the enum definition, and the type property where that enum would supposedly be used is a string). Thanks for reporting.

zbjornson avatar Mar 12 '20 16:03 zbjornson

electron has some tooling to generate type defs from docs, might be worth looking at, some discussion recently at https://github.com/nodejs/node/issues/32206

sam-github avatar Mar 13 '20 04:03 sam-github

export enum MetricType {
	Counter,
	Gauge,
	Histogram,
	Summary,
}

These code just just declare in index.d.ts , not real exsist in index.js , I'm confused.

I use it in my code throw error when run app.

MetricType.xxx  not exsist..

Can you export real enum ( just like enum,Maybe it's an object ) or delete the declare?

My Englisth is poor. thank you.

LastKing avatar Jun 18 '20 13:06 LastKing