I am trying to get parameters of the electron dialog but I am getting two errors:
Type 'Dialog[U]' does not satisfy the constraint '(...args: any) => any'.
Type 'U' cannot be used to index type 'Dialog'.
I am doing this:
declare global {
interface Window {
dialogOpen: <T, U = keyof Electron.Dialog>(name: U, ...options: Parameters<Electron.Dialog[U]>) => Promise<T>;
}
}
I then tried to manually type the value like this and I get no error.
type Test = Parameters<Electron.Dialog['showOpenDialog']>;
What am I doing wrong when I try to dynamically type the parameters?