Merge "Add some type annotations, mainly to help the IDE." into main