-
Notifications
You must be signed in to change notification settings - Fork 58
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
BufferedMetricsLogger can't be used as a type #119
Comments
The correct way to declare export declare const BufferedMetricsLogger = loggers.BufferedMetricsLogger;
export declare type BufferedMetricsLogger = loggers.BufferedMetricsLogger; |
Hey @jfirebaugh! 👋 Thanks for filing this! Guess I should have included a test of the types when I added support for generating them here. 😓 All the typings here are generated from JSDoc, so I need to figure out the right incantation to get it to do this. Will see what I can figure that out ASAP. |
Hi Rob! Good to see you around. 😄 |
Even though we started generating TypeScript types from the JSDoc a while back, it turns out `BufferedMetricsLogger` was getting exported as a value and not a type, which technically works in TS, but is definitely not what you want. This changes up our syntax a bit to get the compiler to do the right thing, and adds a basic test of the types to make sure we don't regress. Fixes #119.
@jfirebaugh I think I’ve got a working solution over in #120; are you able to test that that works for you, or do you need a pre-release build on NPM? |
I think I would need a pre-release build. I tried putting |
Even though we started generating TypeScript types from the JSDoc a while back, it turns out `BufferedMetricsLogger` was getting exported as a value and not a type, which technically works in TS, but is definitely not what you want. This changes up our syntax a bit to get the compiler to do the right thing, and adds a basic test of the types to make sure we don't regress. Fixes #119.
Even though we started generating TypeScript types from the JSDoc a while back, it turns out `BufferedMetricsLogger` was getting exported as a *value* and not a type. That technically works in TS, but requires some weird syntax and is definitely not what you want. This changes up our imports and exports a bit to get the TypeScript compiler to do the right thing, and adds a basic test of the types to make sure we don't regress. See #119.
@jfirebaugh OK, you should be able to test with |
|
Sorry it took me a while to publish a production release here. This is now available in v0.11.4. |
The following should work (TypeScript playground link):
However, it produces the following error:
(The suggestion the error message provides is not what I meant -- it generates different errors.)
The text was updated successfully, but these errors were encountered: