-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
chore(types): make types retrocompatible to typescript 4.5.5 #571
Conversation
@avallete can you limit the change to |
I'll try but:
https://github.com/supabase/postgrest-js/pull/571/files#diff-5e58fb7db093dc508e6abb63dd5488067ce801a1abbcb5a50644050d106ff1edL174-R179
|
export type FindJoinTableRelationship< | ||
Schema extends GenericSchema, | ||
CurrentTableOrView extends keyof TablesAndViews<Schema> & string, | ||
FieldName extends string | ||
> = ResolveJoinTableRelationship<Schema, CurrentTableOrView, FieldName> extends infer Result | ||
? [Result] extends [never] | ||
? false | ||
: Result | ||
: never |
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.
Make it consistent with the other FindXXRelationship
that return a plain false if no relationship were found instead of never.
@@ -81,7 +81,7 @@ type SelectQueryFromTableResult< | |||
let expected: { | |||
msgs: { | |||
id: number | |||
message_details: SelectQueryError<`Could not embed because more than one relationship was found for 'messages' and '${string}' you need to hint the column with messages!<columnName> ?`> | |||
message_details: SelectQueryError<'could not find the relation between messages and message_details'> |
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.
This one was actually invalid given the database definition. I added a runtime test for it and adapted the expected error message accordingly.
I've rebased this one over the correct branch so the diff should be much more focus on the actual changes for 4.5.5 compatibility. Also reverted some noise with the never replacement / new errors that wasn't necessary to the conversion. Note that this PR should be merged after the one it base itself of: #569 |
…s-retrocompatible-to-4-5-5
🎉 This PR is included in version 1.17.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
One of the probable reason causing the number of issues we had with the new inference is probably the use in our tests of typescript
~4.7
, insupabase-js
we can see the version of typescript is4.5.5
.This PR is here to reduce the migration friction by allowing the new parser to be retro-compatible with lower typescript version, down to 4.5.5 (I tested down to
4.3.3
).The main change across all was to get rid of the new convenient
infer X extends Y
syntax only available in typescript 4.7 and higher.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.