-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Wrong type for joins with one-to-one relationships #471
Comments
I'm using this as a workaround for now: export function cast<T>(notAnArray: T[]): T {
return notAnArray as T;
} And then: console.log(cast(profile_result.data.customers).stripe_customer_id) |
Update: I've changed my workaround to this: export function fixOneToOne<T>(objectOrNull: T[]): T | null {
return (objectOrNull as T) || null;
} I've changed the return type to In the example above, the correct type should be: {
stripe_customer_id: string;
} | null |
I encountered the same issue today and I found another workaround.
|
I am experiencing the exact same issue. As my query is rather nested, workarounds are very inconvenient... Does anyone know, whether an older version does not have this bug included? |
Seems to still be an issue |
Same problem over here, is there a fix for this issue?? |
Same problem here. |
Yep, same here! Please fix when possible |
Still a problem, please fix! |
Bug report
Describe the bug
I have a
profiles
and acustomers
table, with a one-to-one relationship:When doing a join between these, TypeScript thinks the type of
customers
is this:But when I run the code, this is the actual type I get:
So when accessing the
stripe_customer_id
property, I get this type error:To Reproduce
Expected behavior
The TypeScript type should not be an array for one-to-one relationships. It should match the actual type
System information
Additional context
Related:
The text was updated successfully, but these errors were encountered: