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

118
Visualizações
Type Promose<Response> is missing

I am getting this error and I am not sure why. In my dialog class I have the Promse and the fail logic. I am getting this build error any help would be great.

Severity Code Description File Project Line Suppression State Error TS2740 (TS) Type 'Promise' is missing the following properties from type 'JQueryPromise': state, always, done, fail, and 2 more.

 var responsePromse = this.agentManager.getStyleGuideByAgentId(this.model.Id);

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

AgentManager

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

AgentService

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

Conroller

 [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 Respostas
Responde à pergunta

0

TS Error message like this format Type 'A' is missing following properties from type 'B' means that, you typed 'B' explicitly to a value, but type of the value is actually 'A'.

so, You typed something explicitly as JQueryPromise, but that thing was actually Promise.

I think this code makes error.

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

I'm not sure but getStyleGuideByAgentId actually returns standard Promise, not JqueryPromise due to toPromise()

so, changing code like this might be solve your problem.

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 Relatório
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