Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
No se puede declarar la función onComplete en Conf.ts >>Obteniendo error: el tipo '(aprobado: cualquiera) => void' no se puede asignar al tipo '() => void'.ts(2322)

Estoy trabajando en un Protractor - framework browserstack desde cero.

Al usar la función onComplete como se menciona en el sitio en conf.ts - https://automate.browserstack.com/dashboard/v2/quick-start/get-started#introduction

 // Code to mark the status of test on BrowserStack based on test assertions onComplete: function (passed) { if (!passed) { browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "At least 1 assertion has failed"}}'); } if (passed) { browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "All assertions passed"}}'); } }

Recibo el siguiente error en la consola

*Depurador adjunto. conf.ts:87:1 - error TS2322: el tipo '(aprobado: cualquiera) => vacío' no se puede asignar al tipo '() => vacío'. 87 onComplete: función (aprobada) {

 node_modules/protractor/built/config.d.ts:410:5 410 onComplete?: () => void; ~~~~~~~~~~ The expected type comes from property 'onComplete' which is declared here on type 'Config'* Can someone help me understand how to resolve this error?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto parece un error en las definiciones de tipo para onComplete. En el uso, parece que a onComplete se le pasa una variable. Consulte: https://github.com/angular/protractor/blob/master/lib/frameworks/jasmine.js#L109-L115

 const originalOnComplete = runner.getConfig().onComplete; jrunner.onComplete(async(passed) => { try { if (originalOnComplete) { await originalOnComplete(passed); }

Aunque podría crear un config.ts de TypeScript, podría ser mejor crear un archivo config.js. El uso de config.ts también podría tener problemas cuando desee hacer referencia al objeto del navegador. La variable del navegador tendría que ingresarse a través de require en lugar de import.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!