You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type-checker (pyright in my case) assumes that order is an instance of the OrderFactory, not Order.
When using OrderFactory.create() or OrderFactory.build(), result will be Unknown and at least type checked would not complain.
Proposed solution
Would be nice to have support for type annotations. Or, at least - define return type for __init__ as Any, so type checker would not incorrectly assume wrong type.
The text was updated successfully, but these errors were encountered:
The problem
When using factory in the following way:
Type-checker (pyright in my case) assumes that
order
is an instance of theOrderFactory
, notOrder
.When using
OrderFactory.create()
orOrderFactory.build()
, result will beUnknown
and at least type checked would not complain.Proposed solution
Would be nice to have support for type annotations. Or, at least - define return type for
__init__
asAny
, so type checker would not incorrectly assume wrong type.The text was updated successfully, but these errors were encountered: