beanie icon indicating copy to clipboard operation
beanie copied to clipboard

Fix: FindInterface type-hints break on View models

Open GuyGooL5 opened this issue 1 year ago • 5 comments

This PR adds a new TypeVar for View just like DocType, and is used in FindInterface to bind it for each model with their respective model type.

It fixes a bug where find operations type-checks break when used with View descendants. For example, see this issue.

GuyGooL5 avatar Jan 01 '24 15:01 GuyGooL5

Hi @GuyGooL5 , Could you please run pre-commit against your changes? Thank you for the PR!

roman-right avatar Jan 10 '24 23:01 roman-right

Hi @roman-right, unfortunately I've found that my solution isn't all-inclusive and there are many edge cases, I'm drafting this PR and will work on it.

GuyGooL5 avatar Jan 11 '24 10:01 GuyGooL5

Hi @GuyGooL5 , Yes sure. Thank you for your work!

roman-right avatar Jan 11 '24 14:01 roman-right

@roman-right I hope that's enough for a fix. I tested the type inference in VSCode and it seems to work, is there maybe a test I can implement to future-proof it from a static-type checker's perspective?

GuyGooL5 avatar Jan 13 '24 13:01 GuyGooL5

Hi @GuyGooL5 , Thank you for the PR! I'll check it this week

roman-right avatar Jan 16 '24 15:01 roman-right

Hi @GuyGooL5 , Thank you for your work. Merged. It will be published in a few days

roman-right avatar Jan 22 '24 17:01 roman-right

Great news, thanks.

GuyGooL5 avatar Jan 24 '24 13:01 GuyGooL5