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

fix(types): types result with schema as any #570

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

avallete
Copy link
Member

What kind of change does this PR introduce?

Fixes the regression in the types inferences if the client is called without a valid schema and defaulted to any

Context: https://discord.com/channels/839993398554656828/1300816893682126912/1301172995326476288

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

@avallete avallete requested a review from soedirgo October 31, 2024 17:00
@avallete avallete marked this pull request as ready for review October 31, 2024 17:02
@soedirgo
Copy link
Member

soedirgo commented Nov 5, 2024

I'd rather we keep the previous behavior and just return any for the whole result if Database is any - we never intended type safety to apply if users don't supply database types.

@avallete
Copy link
Member Author

avallete commented Nov 5, 2024

I'd rather we keep the previous behavior and just return any for the whole result if Database is any - we never intended type safety to apply if users don't supply database types.

We totally can. Just to make sure what you say "keep the previous behavior" you mean the "new previous one" ? 😅

Because what I reproduced here was based on the results were with an any Database in v1.16.2.

So we can decide to change this in favor of "everything is any" but it'll probably be considered as a breaking change by the users so maybe we wanna warn them somehow, or make it clear in the release that this was undesired behavior before.

@soedirgo
Copy link
Member

soedirgo commented Nov 5, 2024

I meant the old one before the select-query-parser rewrite - it should be returning the whole result type as any:

Screenshot 2024-11-05 at 3 59 49 PM

(This is v1.16.3)

@avallete
Copy link
Member Author

avallete commented Nov 5, 2024

I meant the old one before the select-query-parser rewrite - it should be returning the whole result type as any:

Screenshot 2024-11-05 at 3 59 49 PM (This is v1.16.3)

Yes but not only 😅 everything that's into test/select-query-parser/default-inference-d.ts was working the same way in 1.16.3 from my testing, which is why I reproduced the behavior in the first place:

Screenshot 2024-11-05 at 09 20 02 Screenshot 2024-11-05 at 09 20 12

BTW I also added a simple test where we select nothing, which give back any[]

@soedirgo
Copy link
Member

soedirgo commented Nov 5, 2024

Ahh ok got it - yeah let's preserve this behavior then 👍

@soedirgo soedirgo merged commit 2352eb1 into master Nov 5, 2024
1 check passed
@soedirgo soedirgo deleted the fix/infer-default-result-for-untyped-client branch November 5, 2024 08:24
Copy link

github-actions bot commented Nov 5, 2024

🎉 This PR is included in version 1.17.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants