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

TS types #45

Merged
merged 10 commits into from
May 21, 2021
Merged

TS types #45

merged 10 commits into from
May 21, 2021

Conversation

kibertoad
Copy link
Contributor

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 used export = SonicBoom; as it was the case in the past, neither named, nor default imports would work without esModuleInterop 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.

@mcollina
Copy link
Member

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

@kibertoad
Copy link
Contributor Author

okay! I'll add them

@fox1t
Copy link

fox1t commented Sep 23, 2020

Copy link

@fox1t fox1t left a 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!

Copy link

@fox1t fox1t left a 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 "../";
Copy link

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 :)

@mcollina
Copy link
Member

@kibertoad could you rebase this PR?

@kibertoad
Copy link
Contributor Author

@mcollina Sure thing, will focus on everything needed for pino types this evening.

@kibertoad
Copy link
Contributor Author

@mcollina Done!

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 4b09301 into pinojs:master May 21, 2021
@kibertoad kibertoad deleted the feat/types-v2 branch July 15, 2021 17:18
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

Successfully merging this pull request may close these issues.

3 participants