The first type:
declare type roles = 'admin' | 'user';
The other type
declare type ROLES = 'ADMIN' | 'USER';
I need to assign from the first to the second, this is my current code:
const r: roles = 'admin';
const R: ROLES = r.toUpperCase() as ROLES;
But I don't want to explicitly cast, is there any better workaround without enforcing the cast?
EDIT: The solution I went with:
const r: roles = 'admin';
const R: ROLES = r.toUpperCase() as Uppercase<roles>;
With this approach, if later a new value added to roles but not ROLES, TS will complain about the mismatch.