Context
Token.map is correctly typed as list[int] | None: some tokens have no source map. The built-in fence and html_block rules always populate it, but consumers of those tokens must still assert that map is non-None or add a defensive branch solely to narrow its type.
Proposal
Add an accessor such as Token.require_map() -> list[int] that raises a clear exception when no map is present. This preserves the optional type of map while allowing consumers to use mapped tokens without local assertions or lint suppressions.
Context
Token.mapis correctly typed aslist[int] | None: some tokens have no source map. The built-infenceandhtml_blockrules always populate it, but consumers of those tokens must still assert thatmapis non-Noneor add a defensive branch solely to narrow its type.Proposal
Add an accessor such as
Token.require_map() -> list[int]that raises a clear exception when no map is present. This preserves the optional type ofmapwhile allowing consumers to use mapped tokens without local assertions or lint suppressions.