-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
A weird TypeScript error when lazy loading a related entity #1082
Comments
Hey there! 👋🏻 This reminds me of an older TypeScript bug: microsoft/TypeScript#37778. I'm not certain they're related, but does the issue persist if you downgrade Lucid or TypeScript? Also, could you create a minimal repository demonstrating the problem? |
Its the same issue, since it was never fixed in the first place by the TypeScript team |
It may not be related to that bug because it works fine in Lucid v20 but breaks in v21. Here are the minimal reproducible setups With v20 (Build succeeds) With v21 (Build fails) |
I think the bug was introduced in 532b9cb. If you change extends ModelRelations<LucidModel, LucidModel> to extends ModelRelations<infer _, infer __> in type ExtractModelRelations<Model extends LucidRow> = {
[Key in keyof Model]: Model[Key] extends ModelRelations<LucidModel, LucidModel> ? Key : never;
}[keyof Model]; That may fix the issue. I don't know if that can have any other implications. |
Package version
21.5.1
Describe the bug
I have relations with the simplified version being this
I see an error on that
this.load('project')
call.It used to work fine in version
20.4.0
. May be something changed in version 21.Reproduction repo
No response
The text was updated successfully, but these errors were encountered: