See example below, type checker complains though it is possible to assign None to active attribute (or get None from it), so active should have a type typing.Optional[Object] instead of Object.
import bpy
# Cannot assign to attribute "active" for class "LayerObjects"
# "None" is incompatible with "Object"
bpy.context.view_layer.objects.active = None
fake-bpy-module-latest==20240522
See example below, type checker complains though it is possible to assign None to
active
attribute (or getNone
from it), soactive
should have a typetyping.Optional[Object]
instead ofObject
.