Comment on Adding type safety to object IDs in TypeScriptComments−sagia2yI wonder if a similar (but maybe more bloated) implementation using interfaces (and probably generics too?) will work in this case.−jeroenhd2ySomething like this, maybe?https://www.typescriptlang.org/play?#code/C4TwDgpgBAkgIlAvFA...Alternatively, with generics: 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.
Comments
I wonder if a similar (but maybe more bloated) implementation using interfaces (and probably generics too?) will work in this case.
Something like this, maybe?
https://www.typescriptlang.org/play?#code/C4TwDgpgBAkgIlAvFA...
Alternatively, with generics: 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.