C#10 Has extended the property pattern ability, I think it began since #7
EG:
{ Car: { Interior: pattern } }
Meaning you can do some nice pattern matching even in if statements
if (car_var is Interior leather) { .. }
It's been extended to manage switches etc.
In TS: using filters (maybe not), I would like to write a helper method that could perform this.
if(car is Leather { size: large, colour: black}) {
// do specific work for this model definition
}
I could define a model library that would be able to behave like constants in TS.
I can see there is a proposal, here but I haven't found a clean // nice way to do it, and I'm not sure if I write a library that overwrites the if
check is the right way.
If I write my own, how can I ensure it's forward compatible and what are things to look out for or be aware of ?
Note: I do contribute to the Opensource of TypeScript but not as much as this would involve.