Is it possible to map a string literal type as a key in a new type?
I attempted this, but it did not work as expected.
const obj = {
type: "key",
actions: {
a() {},
b() {},
},
} as const;
/* Map to
{
key: {
a() {},
b() {},
}
*/
type ObjectA = typeof obj
type TypeT = {
ObjectA['type']: ObjectA['actions']
// 'ObjectA' only refers to a type, but is being used as a value here.ts(2693)
}