About the functional way to spell a TypedDict:
In this reply in the tread about pass expressions, we were introduced (at least I’ve never heard of it before) to the idea of conditional key - value pairs in dictionaries. Said syntax could be used to do the same in TypedDicts too.
TD = TypedDict("TD", {"x": int, "y": str if sys.version_info >= (3, 12) else pass})