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

Cannot use namespace 'SonicBoom' as a type. #44

Closed
jontroncoso opened this issue Sep 23, 2020 · 8 comments
Closed

Cannot use namespace 'SonicBoom' as a type. #44

jontroncoso opened this issue Sep 23, 2020 · 8 comments

Comments

@jontroncoso
Copy link

When using @types/pino for pino which has sonic-boom as a dependency and uses @types/sonic-boom for the types, I get Cannot use namespace 'SonicBoom' as a type.. After tracking this down this has to do with a discrepancy between @types/sonic-boom and sonicboom/types/index.d.ts.

Specifically:

export default SonicBoom;

should be

export = SonicBoom;
@jontroncoso
Copy link
Author

jontroncoso commented Sep 23, 2020

If you're gettin this, a solution for me was to explicitly use

"sonic-boom": "1.1.0",

In any custom pino-wrapper packages

@jontroncoso
Copy link
Author

jontroncoso commented Sep 23, 2020

If you can somehow fix the @types/pino repo You may be able to leave this how it is.

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pino/index.d.ts#L23

Specifically change

import SonicBoom = require('sonic-boom');

to

import SonicBoom from 'sonic-boom';

But I don't know which is easier to do nor which is most correct.

@mcollina
Copy link
Member

@kibertoad ptal.

@mcollina
Copy link
Member

@jontroncoso the easiest way is for you to send a PR.

@kibertoad
Copy link
Contributor

IIRC correctly, export = x requires esinterop enabled and we removed it from other places, such as fastify-swagger, for same reason.
I'll take a look if it can be fixed in non-breaking way.

@kibertoad
Copy link
Contributor

@mcollina Instead of changing types-pino, we can merge the pino types PR, that would fix problem as well, but yes, for sonic-boom this likely should have been a semver major.

@mcollina
Copy link
Member

I'm reverting the types here asap.

@jontroncoso
Copy link
Author

@jontroncoso the easiest way is for you to send a PR.

Sure. But, I wasn't sure if you which direction you wanted to go. Anyway, thanks for addressing so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants