You want
- something that captures the string literals as a union of string literal types and
- something that can take that union of literal types and create an object out of it.
(1) can be done with a type parameter (i.e. a generic) constrained to string, and (2) can be done with a mapped type - and it just so happens that TypeScript ships a mapped type called Record<K, T> with it:
interface Foo {
bar<K extends string>(keys: K[], handler: (parameter: Record<K, any>) => void): void;
}
var x: Foo;
x.bar(['First', 'Second'], x => {
console.log(x.First);
console.log(x.);
});

Keep in mind, however, that if someone passes in an empty array or something other than a string literal (e.g. a variable of type string), then you'll get no type safety. You'll be able to access any property on x.
You can get around the empty array case by adding a generic default of never to say "infer the empty union instead of string when given an empty array":
interface Foo {
bar<K extends string = never>(keys: K[], handler: (parameter: Record<K, any>) => void): void;
}