2023-03-03 04:00:53 +00:00
|
|
|
type MapToMessageSetter<T extends MapToInputTestID> = {
|
2023-03-30 21:27:10 +00:00
|
|
|
[MessageSetterID in keyof T]: MessageSetter;
|
2023-03-03 04:00:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
type InputIds<T> = ReadonlyArray<T> | MapToInputTestID;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Given either:
|
|
|
|
* 1. an array of input identifiers, or
|
|
|
|
* 2. a key-value object of input indentifiers,
|
|
|
|
* transform it into a key-value object of identifiers.
|
|
|
|
*/
|
|
|
|
type MapToInputId<
|
|
|
|
U extends string,
|
|
|
|
I extends InputIds<U>,
|
|
|
|
> = I extends ReadonlyArray<U> ? { [K in I[number]]: K } : I;
|