Is it possible to declare our own utility types? #8001
Replies: 1 comment 11 replies
-
Hi, it's not possible right now, and I don't want to give hope on that, it won't happen without a rewrite of Psalm. Every type operation need to be aware of the other existing types. For example, if you create a new special string type, a simple thing like a concatenation need to be aware how your type must behave. Does concatenation on your type must keep your type or must it revert to a string? Should asserting that your type is not empty change your type into a Every single operation, every time a type is included in an union that could contain a parent type should have a special piece of code dedicated to handle your special type. It's a pretty massive work and each interaction need to be thought of in depth |
Beta Was this translation helpful? Give feedback.
-
I would like to create some utility types that I see Psalm is missing, and according to the discussions in the issue section, won't be implemented anytime soon.
Is it possible to do that via the plugin system? If yes, can someone please point me in the right direction?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions