I am unsure how to adresse the question and I do not know if someone can help demonstrate the problematic before a Bug Report or such can be opened but those two are completely different things and this is why I would like to have the help of those TypeScript lovers out there to tell me if they can replicate example of similar situations:
// a +generic interface `A` describing a NON-generic!!! function:
export interface WorkerPoolExec_A<O = unknown> {
(
command_name: string,
options: string[],
message_id: number,
...args: string[]
): Promise<O>;
}
// A NON-generic!!! interface `B` describing a +generic function:
export interface WorkerPoolExec_B {
<O = unknown>(
command_name: string,
options: string[],
message_id: number,
...args: string[]
): Promise<O>;
}
The beloved AI will explain
Despite providing Exactly the text above with bot commented out description I get the wrong inference
[...]
In summary, WorkerPoolExec_A is a non-generic interface
describing a non-generic function.
[and] WorkerPoolExec_B is a non-generic interface
describing a generic function.
I am unable to get the AI to understand (or explain to me) the difference as it produce invalid code…
export const execCommandA: WorkerPoolExec_A<string> = async (
command_name,
message_id,
...args
) => {
// execute the commandA and return a string result
[command_name, message_id, ...args];
return Promise.resolve('');
};
export const execCommandB: WorkerPoolExec_B<string> = async (
command_name,
message_id,
...args
) => {
// execute commandB and return a string result
[command_name, message_id, ...args];
return Promise.resolve('');
};
I would love to have as many examples as possible in order to seek assistance or to open a Trouble Ticket (Bug Report)… I am seeking advice on how to make a clear case such that it could be resolve but I need to understand if it is just me or such