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

[BUG]: TS inference with multiple many-to-manys gets squashed #703

Closed
anthonyshew opened this issue Jun 3, 2023 · 2 comments
Closed

[BUG]: TS inference with multiple many-to-manys gets squashed #703

anthonyshew opened this issue Jun 3, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@anthonyshew
Copy link

What version of drizzle-orm are you using?

0.26.5

What version of drizzle-kit are you using?

i hate drizzle-kit so N/A /s

Describe the Bug

Here's a Stackblitz!: https://stackblitz.com/edit/stackblitz-starters-5s6m8c?file=drizzle%2Ftest.ts

To reproduce:

  • If you go to line 6 of drizzle/test.ts and try to get autocomplete in the with property, you don't get any inference.
  • To get inference back, comment out lines 152 to 156 of drizzle/schema-test.ts.
  • Head back to line 6 of drizzle.test.ts and ask for autocomplete again. Boom, inference.

For extra confirmation, you'll also see the same behavior if you comment out lines 147 to 151 of drizzle/schema-test.ts instead of lines 152 to 156.

Disclaimers:

  • I haven't investigated to see if there are other related edge cases where inference can get dropped. For instance, I didn't check to see if the same thing happens with several one-to-ones or several one-to-manys.
  • I'm figuring this is a TS inference bug rather than a SQL limitation?

Thanks for taking a look Drizzlers. 🙏 Let me know if there's anything else I can do to provide context.

Expected behavior

Those sweet, sweet inferred types.

Environment & setup

Earth, I guess?

@anthonyshew anthonyshew added the bug Something isn't working label Jun 3, 2023
@Angelelz
Copy link
Collaborator

I'm not sure if this was a problem initially or stackblits didn't work properly, but I just tested this in the Typescript playground and it worked properly.

Can you confirm so we can close this issue?

@anthonyshew
Copy link
Author

Very possible this works correctly now since this is from several versions behind.

Your TS playground looks great so I'll close. 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants