3 ms·
I wonder if a similar (but maybe more bloated) implementation using interfaces (and probably generics too?) will work in this case.
by sagia 3y ago
I wonder if a similar (but maybe more bloated) implementation using interfaces (and probably generics too?) will work in this case.
- jeroenhd 3y agoSomething like this, maybe? https://www.typescriptlang.org/play?#code/C4TwDgpgBAkgIlAvFAcgVwLYCMICcDcAUIQJYB2weAZgIYDG0AqgM57xQDehUUokAXFADkaVriEAablBIATQfEIBfYuUq5aDKAHFcAezRh2XHnwiChAc32HJ0uQrjLiVNGTrASeslEOyalCx4ABSieIJBuPAAlJzSdN7MegA2EAB0shBYaJahYmly0UQqhKnAUNYGYEhxpuDmwpW2UjwOUACMAEwAzAAsAKzOhH4BEJHBTWBFQA https://www.typescriptlang.org/play?#code/C4TwDgpgBAkgIlAvFA... Alternatively, with generics: https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgKoGdoEkAiAeXAFQE8AHCAPmQG8AoZZMMiALmQHIBXTKdgGnrJgAEzZFmtAL61aoSLEQoA4lAD2nUrgI4S5KnQZNybdgHM1G-oJFidE6bRicQCMMFUhkG4XEgZoeIQUABTc0Gz+UFpBAJQ0ggge6KoANhAAdMIQAEacpqE86SIxANxSMmlgyObqpMgAvPGGzCY1lgIMNsgAjABMAMwALACs5bTevhCRwW2kpUA https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgA... I don't think these are better, to be honest. The string types suffice and are easier to exchange with servers and other APIs.