How can I provide a generic string array to a function argument and use the generic type in the other function argument?
I want to achieve something like this below:
type Custom<T> = {
hello: string;
world: T;
};
declare function builder<T extends readonly string[]>(
input: T,
arg: () => Custom<T>,
): void
builder(['hello'] as const, () => ({
hello: 'some text',
world: ['1', '2', '3'], // <-- This should fail, as it's not 'hello'!
}));