Could be nice to support composition of literals, so that something like this type checks correctly: ``` from typing import Literal def page(page: Literal["p1", "p2"]): ... def foo(num: Literal["1", "2"]): page(f"p{num}") page("p" + num) page("p" + "1") ```
Activity
sobolevn commentedon Nov 26, 2021
Related https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
brianschubert commentedon Dec 8, 2024
Closing as duplicate of #11990, which was opened later but has more discussion and seems to be the canonical issue linked to by other issues and PRs.