Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetricType enum not exported for use in index.js #336

Open
biswa1shaw opened this issue Feb 23, 2020 · 3 comments
Open

MetricType enum not exported for use in index.js #336

biswa1shaw opened this issue Feb 23, 2020 · 3 comments
Labels

Comments

@biswa1shaw
Copy link

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
@zbjornson
Copy link
Collaborator

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 zbjornson added the bug label Mar 12, 2020
@sam-github
Copy link
Contributor

electron has some tooling to generate type defs from docs, might be worth looking at, some discussion recently at nodejs/node#32206

@LastKing
Copy link

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.

@zbjornson zbjornson changed the title MetricType enumnot exported for use in index.js MetricType enum not exported for use in index.js Jan 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants