Next step: Auto-inferring the correct (most narrow) TypedDict type from a frozendict. (Think `const foo = { … } as const` in TypeScript.) I miss this TS feature in Python on the daily.
Curious what this means for typescript as well; honestly I've only reached for as const rarely.
Agreed... but it shouldn't need a frozendict for this
IMHO TypedDict in Python are essentially broken/useless as is
What is needed is TS style structural matching, like a Protocol for dicts
I also SUPER LOVE this feature. Especially when you make a type union of the keys for easier indexing.
Can you give a Python example of a use case for this?
What would that do exactly? Auto-generate a TypedDict class?
Bringing up TypedDict is sort of interesting, because it seems like a frozen dictionary could have been implemented by PEP 705, if typing.ReadOnly was enforced at runtime, and not just a hint to a static type checker.