How can I resolve the TypeScript error 'Function lacks ending return statement and return type does not include 'undefined'' in my code?

My understanding is that the make function can only either return a string (inside the try block) or throw an error once the retries have been exhausted.

I'm fairly sure you're right, but TypeScript can't quite follow logic that complex, so it (incorrectly, I think) sees a path through the function that doesn't do an explicit return and so implicitly returns undefined (wrapped in a promise).
You can solve it in a few ways:

Add a return ""; at the end with a comment noting it'll never happen. (Blech.)
Add a throw new Error("Logic error, this will never be reached."); at the end.
Rewrite the function to make the final attempt more obviously a return-or-throw situation by using < instead of <= and then repeating the return await handle(); at the end. (Not great to have to repeat it, but it's very simple.)

I don't think #1 or #2 need examples, but here's what #3 might look like:
const make = async (): Promise<string> => {
    const MAX_RETRIES = 2;
    for (let idx = 0; idx < MAX_RETRIES; idx++) {
        try {
            return await handle();
        } catch (err) {
            continue; // I guess technically we don't need this, since
                      // the loop doesn't do anything else
        }
    }
    return await handle();
};

For me, #2 is the winner (or jcalz's rewrite), but any of them will make TypeScript happy, it's really a style choice.

I have the following simple function (make) that calls the handle function and is supposed to retry a number of times whenever that function throws. If the retries are exhausted, the make function should throw the error.
const handle = async (): Promise<string> => 'hi';

const make = async (): Promise<string> => {
  const MAX_RETRIES = 2;
  for (let idx = 0; idx <= MAX_RETRIES; idx++) {
    try {
      return await handle();
    } catch (err) {
      if (idx < MAX_RETRIES) {
        continue;
      } else {
        throw err;
      }
    }
  }
};

I'm using TypeScript, which is complaining because the return type doesn't include undefined:

Function lacks ending return statement and return type does not include 'undefined'.

For reference, this is the TS Playground for the code above.
I'm looking for guidance on how to handle the return type for the function.
Note that:

I don't want to change my tsconfigs (currently set to strict)
I don't want to modify the return type to Promise<string | undefined>

My understanding is that the make function can only either return a string (inside the try block) or throw an error once the retries have been exhausted. If that's the case then where does the undefined that TS is asking for comes from? Am I missing something?
