Closed jwhonce closed 8 months ago
Hi, thanks for submitting this! I've been doing some typing work myself lately so went ahead and merged that.
I think most of these # type: ignore
s should actually be properly fixed. IMO that should generally only be used for special cases like descriptors, wherein there's a fundamental impasse between the API and implementation.
There are a couple different classes of common problems, and I see you've already addressed some of them this way, but I think this approach can be applied to the remaining # type: ignore
s as well.
None
: add | None
to the typeExamples:
_entity_id
is None
_entity_id: str = None
None
until setup (e.g. upon being accessed by user), then can become None
again later (e.g. upon invalidate()
)
_backing: dict[str, str | int | bool] = None
None
: remove = None
Essentially if it's initialized in __init__
, then it can be simply declared - it's not expected to be None
at any point during its lifecycle.Example:
_state
is initialized in __init__
, it should have a valid State
during its whole lifecycle
_state: State = None
Some of them may be more tricky than others, or require more in-depth knowledge of the design. Feel free to leave those and I'll be happy to work on them.
With changes in trilium-notes future, I have moved to logseq.