Bug: Incorrect typing in SQLAlchemyAsyncRepositoryReadService #261
Labels
accepted
Change or enhancement is accepted for development.
bug
Something isn't working
help wanted
Extra attention is needed
Description
Firstly repository_type is uninitialized. This automatically raises an issue if strict.
But more importantly when you do something like this: Which happens in the litestar fullstack example
And then try to do
Typechecker complains that
Type "SQLAlchemyAsyncRepositoryProtocol[User] | SQLAlchemyAsyncSlugRepositoryProtocol[User]" is not assignable to type "UserRepository"
URL to code causing the issue
No response
MCVE
This is easier to see with a completely synthetic example
The type checker complains that Type
"ClassA | ClassB" is not assignable to type "ClassSA"
This might be a bug in pyright. But I think the behavior does make sense because at runtime ctype() could still return ClassB. So a Cast is needed
Steps to reproduce
Screenshots
"In the format of:
![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)
"Logs
No response
Package Version
0.20.0
Platform
The text was updated successfully, but these errors were encountered: