Add Typing to getTextWithFields (PR #12969)
Add Typing to getTextWithFields
- _getFieldsInRange must return a TextWithFieldsT
TextWithFieldsT is List[Union[str, FieldCommand]]
- getTextWithFields returns the result directly and has type annotation
declaring it returns TextWithFieldsT.
Other usages of _getFieldsInRange seem to filter out None, although
it is hard to be conclusive about this.
- Handle any None values to return TextInfo.TextWithFieldsT
Note that XMLTextParser().parse
returns List[Union[FieldCommand, Optional[str]]]
- TextInfo.TextWithFieldsT is str not optional:
List[Union[str, FieldCommand]]