I realize it is probably against TypeScript philosophy, but thought I'd still ask.
Is it possible to convert a type literal into a string literal at compile time?
E.g., can I assign "AnotherString"
to str2
below without repeating it?
// object to type, no problem
const obj = "SomeString";
let str1: typeof obj = obj;
// type into obj: ?
type SomeType = "AnotherString";
const str2: SomeType = valueof SomeType; // no such thing as valueof