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
However, the chalice package does not export this type in init.py, so there is no importable definition of the class to use, which results in errors from IDEs and type-checkers like MyPy.
Exporting all the event classes would prevent the error in a type annotation, but may generate warnings when attributes are referenced, since those appear to be dynamically generated for each subclass. There might not be much advantage over just exporting the BaseLambdaEvent class as a "minimum viable type checking" solution.
It might be better to create a separate type stub library that can be imported if TYPE_CHECKING: that provides dummy classes with the specific attributes actually created for each event class.
The text was updated successfully, but these errors were encountered:
The Chalice documentation for the CloudWatchEvent class gives an example function with a type annotation:
However, the
chalice
package does not export this type in init.py, so there is no importable definition of the class to use, which results in errors from IDEs and type-checkers like MyPy.Exporting all the event classes would prevent the error in a type annotation, but may generate warnings when attributes are referenced, since those appear to be dynamically generated for each subclass. There might not be much advantage over just exporting the
BaseLambdaEvent
class as a "minimum viable type checking" solution.It might be better to create a separate type stub library that can be imported
if TYPE_CHECKING:
that provides dummy classes with the specific attributes actually created for each event class.The text was updated successfully, but these errors were encountered: