How to avoid adding "async" to hundreds of locations in my code when adding a simple fetch call? : <p>I'm working on a big project with complex code that is not well written, it looks like spaghetti, with a lot of imbrications, functions calling each other with a lot of stack depth.</p>

<p>Please note that as of now, <strong>the project code is 100% synchronous</strong> (no promises, no API calls, no database, no IO - it's a very complex test project that relies on hardcoded scenarios).</p>

<p><strong>The evolution I need to code:</strong></p>

<p>In a very deep sub-function, I need to do a very simple API call (using fetch) to return a simple integer value to the parent function, instead of an hardcoded value.</p>

<p><strong>The problem I get:</strong></p>

<p>Obviously, I need to change this function to async and I need to await for the result.</p>

<p>But now, in the functions calling it, I need to await for the result, which means I need to set those parent functions to async as well, but then their parents need to await and to become async... All the way to the top, which, in this project, I estimate to around 100 functions to update.</p>

<p>Is there a way to do this that wouldn't require refactoring so much occurences?</p>
