-
Notifications
You must be signed in to change notification settings - Fork 41
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
TS types #45
TS types #45
Conversation
…feat/types-v2 � Conflicts: � package.json
I'll just go with the semver-major route when we ship pino v7. Also, I think we'd need https://github.com/fastify/fastify/blob/master/fastify.js#L600-L613 as well. cc @fox1t |
okay! I'll add them |
@mcollina yes we need them since https://github.com/mcollina/sonic-boom/pull/45/files#diff-88bec6beae84369c0376b56b3bb88fe1R8 exports default and https://github.com/mcollina/sonic-boom/pull/45/files#diff-88bec6beae84369c0376b56b3bb88fe1R10 exports named. @kibertoad good work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding the "infamous triplet" this can be merged!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
import { SonicBoom } from "../"; | ||
import SonicBoomEsm from "../"; | ||
import { SonicBoom as SonicBoomNamed } from "../"; | ||
import SonicBoomDefault from "../"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! We should add this import test in every package we maintain :)
@kibertoad could you rebase this PR? |
@mcollina Sure thing, will focus on everything needed for pino types this evening. |
…feat/types-v2 � Conflicts: � package.json
@mcollina Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Second iteration of #43, supporting named imports as well. Note that this still doesn't support
import SonicBoom = require('sonic-boom');
style of imports the way DefinitelyTyped types did. See fastify/fastify#2404 and fastify/fastify-swagger#282 for in-depth discussion on the topic of why organize exports this way. If we usedexport = SonicBoom;
as it was the case in the past, neither named, nor default imports would work withoutesModuleInterop
enabled.@mcollina If we want to avoid semver major, I can create a separate PR that includes DefinitelyTyped types verbatim, avoiding any incompatibilities, but not playing nice with proper ESM imports, and then create a separate semver-major one that changes the export signature. Your call.