Alternatively for the case of id strings with known prefixes, a unique feature of TypeScript is you can use template string literal types:
https://www.kravchyk.com/adding-type-safety-to-object-ids-ty...
https://www.kravchyk.com/adding-type-safety-to-object-ids-ty...