Feature summary (what you would like to be able to do and where): pywikibot.pagegenerators has a WikidataSPARQLPageGenerator generator that returns either entity pages or normal pages depending on if the site given is a DataSite or just a normal Site.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution): Looking through the code, there are two cases:
Case 1: When the site is a DataSite, it will return an iterator of ItemPages, PropertyPages, and/or LexemePages, depending on the query
Case 2: Where the site is not a DataSite, it will return an iterator of Pages that are the sitelinks of any items that would be returned in Case 1.
This presents a very obvious opportunity for using @typing.overload and making two function type signatures.
Benefits (why should this be implemented?): Static type checkers would now have a much easier time when working with the first case, since there is very little one can do with an item when knowing it's a Page object since you cannot actually manipulate the item.