Skip to content

Types: Actually add "pg" property to FastifyInstance (semi-breaking) #69

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

Merged
merged 1 commit into from
Nov 13, 2020
Merged

Types: Actually add "pg" property to FastifyInstance (semi-breaking) #69

merged 1 commit into from
Nov 13, 2020

Conversation

voxpelli
Copy link
Contributor

@voxpelli voxpelli commented Nov 9, 2020

Follow up to #68.

This actually adds PostgresDb as the type of fastify.pg by default – and it adds Record<string, PostgresDb> as the default as well.

This means that anyone trying to access fastify.pg will get the correct types, with any additional property outside of the default ones being exposed as possible multi DB:s.

What do you think @mcollina @fox1t?

This definition will conflict with anyone who has made a local definition of the fastify.pg property, as was previously recommended, so from a types point of view this should probably require a 4.0.0 release?

Checklist

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, I'd be happy to land this in a semver-minor.

@mcollina mcollina requested a review from fox1t November 10, 2020 16:18
@mcollina
Copy link
Member

I've seen types break in patch, minor and everything, as well as TS shipping breaking changes in minors. I'm not really concerned, the TS community is pretty loose on semver.

Copy link
Member

@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.

I really like this implementation!
LGTM!

@fox1t
Copy link
Member

fox1t commented Nov 12, 2020

I agree to ship this in a minor, as usual.

@mcollina mcollina merged commit a45dd9e into fastify:master Nov 13, 2020
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