4 ms·
Huh, good to know. Does this issue apply to f-strings or are you talking about format methods? I did a brief look through issues and MyPy seems to support f-str
by Townley 6y ago
Huh, good to know. Does this issue apply to f-strings or are you talking about format methods? I did a brief look through issues and MyPy seems to support f-strings fine, but I’d 100% believe that there are still kinks to work out
- habitue 6y agoAh, so mypy supports fstrings, but not in types. So you can do Direction = Literal["left", "right"] But this won't work: eft = "eft" ight = "ight" Direction = Literal[f"l{eft}", f"r{ight}"] (Yes, this is super contrived, I bad at coming up with examples, but https://mariusschulz.com/blog/string-literal-types-in-typescript https://mariusschulz.com/blog/string-literal-types-in-typesc... shows some realistic examples where it's useful in typescript)