How to return promise in partially async function

Discussão em 'Angular' iniciado por Aria, Março 10, 2025.

  1. Aria

    Aria Guest

    I have a function that goes like this:

    async function(field1, field2) : Promise<boolean> {
    if(true) {
    await nestedFunc().then(
    return true;
    )
    } else {
    return false;
    }
    }


    and I have two instances where the func should return true and false, but I can't get the function to ever return false. In the else section, there is no await function but there is in the if section. I put a debugger and it gets into the else section, but the function ends up returning as true when called. Why could this be happening?

    Continue reading...

Compartilhe esta Página