Advanced type mapping operators
Question
Hi,
I cannot really find anything about the longer term ambition for ty. I know it is early days. Is the long term goal to give a similar feature set and developer experience as in typescript?
Version
No response
Can you say more about what TypeScript features you have in mind?
An example is the keyof keyword in typescript. Could you see ty inferring keys doing something like this Literal[*example_dict]
Another example could be something like Partial<>. Could generic utility types like those exist?
Thanks. For reference, TypeScript supports many type mapping operators that allow creating new types by mapping over existing types (similar to map but instead of mapping a value, mapping a type).
We're interested in experimenting on new typing features (and we already did by introducing intersection types) once we ship a stable version of ty. However, we also want to do it without fragmenting Python's typing ecosystem. Meaning, ideally we'd propose those new features to the Python's typing specification (maybe after some experimentation on our end)
Thanks. For reference, TypeScript supports many type mapping operators that allow creating new types by mapping over existing types (similar to
mapbut instead of mapping a value, mapping a type).We're interested in experimenting on new typing features (and we already did by introducing intersection types) once we ship a stable version of ty. However, we also want to do it without fragmenting Python's typing ecosystem. Meaning, ideally we'd propose those new features to the Python's typing specification (maybe after some experimentation on our end)
Ah, yes, exactly what I was thinking about.
I acknowledge the tradeoffs you have to make. I understand that it would be most beneficial to have these in Python's typing specification, however, that can be a fairly long process. Maybe you could consider making some of these features opt-in, and support them natively in ty, to the extend it makes sense. Just throwing ideas.