// const tmp = ['foo', 'bar'] as const; // const result = recordFromArrayWithValue(tmp, true); // returns { foo: true, bar: true } // result has strictly typed keys foo and bar export const buildRecordFromKeysWithSameValue = ( array: string[] | readonly U[], value: T, ): Record => Object.fromEntries(array.map((key) => [key, value])) as Record;