Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
TypeScript how to call function with its name

I am new to typescript, when I type: (dialog is imported from a library)

ipcMain.handle("openDialog", (event, method, config) => {
  return dialog[method](window, config);
});

It is working in javascript but it throws Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'Dialog' in typescript.
After finding some solutions online, none of them can solute this error for me.
That is what I have now:

ipcMain.handle("openDialog", (event : any, method : keyof Electron.Dialog, config : any) => {
  return dialog[method](window, config);
});

and I only got:

This expression is not callable.
  Each member of the union type '{ (browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>; (options: CertificateTrustDialogOptions): Promise<...>; } | ... 6 more ... | { ...; }' has signatures, but none of those signatures are compatible with each other.

Any solutions?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda