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

116
Views
Falta el tipo Promose<Response>

Recibo este error y no estoy seguro de por qué. En mi clase de diálogo tengo Promse y la lógica de falla. Recibo este error de compilación, cualquier ayuda sería genial.

Gravedad Código Descripción Archivo Proyecto Línea Supresión Estado Error TS2740 (TS) Al tipo 'Promise' le faltan las siguientes propiedades del tipo 'JQueryPromise': state, always, done, fail y 2 más.

 var responsePromse = this.agentManager.getStyleGuideByAgentId(this.model.Id); responsePromse.then((response) => { this.styleguideNote.AgentType = response.responseObject.Name; }).fail(() => { this.relatedTemplates.loadingState = 0; });

Administrador de agentes

 getStyleGuideByAgentId(Id: number): JQueryPromise<any> { var request = this.agentsService.getStyleGuideByAgentId(Id); console.log(request); return request; }

AgenteServicio

 getStyleGuideByAgentId(Id: number) { var x = this.http.post(this.apiUrls.GetStyleGuideNotes, JSON.stringify(Id), { headers: ServiceBase.headers }).toPromise(); return x; }

controlador

 [HttpPost] public IHttpActionResult GetStyleGuideNoteById(long agentId) { var dbResult = StyleGuideNotesDataService.GetStyleGuideNoteById(agentId); var styleguideNote = dbResult .Select(x=> new { Section =x.Section, AgentType = x.AgentType, Status = x.Status.Name }) .Distinct() .ToList(); return Ok(styleguideNote); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Mensaje de error de TS como este formato Type 'A' is missing following properties from type 'B' significa que escribió 'B' explícitamente en un valor, pero el tipo del valor es en realidad 'A'.

Entonces, escribiste algo explícitamente como JQueryPromise , pero esa cosa en realidad era Promise .

Creo que este código da error.

 getStyleGuideByAgentId(Id: number): JQueryPromise<any> { var request = this.agentsService.getStyleGuideByAgentId(Id); console.log(request); return request; }

No estoy seguro, pero getStyleGuideByAgentId en realidad devuelve Promise estándar, no JqueryPromise debido a toPromise()

entonces, cambiar el código como este podría resolver su problema.

 async getStyleGuideByAgentId(Id: number): Promise<any> { var request = await this.agentsService.getStyleGuideByAgentId(Id); console.log(request); return request; }
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!