Minor improvements to optional type annotations