4 ms·
> function getData() { return fetch(…); } I feel like there are advantages to making it `async function`, even if it's superfluous, because it signals
by Cpoll 4y ago
> function getData() {
return fetch(…);
}
I feel like there are advantages to making it `async function`, even if it's superfluous, because it signals to readers and to static code analysis that the function returns a promise. That's assuming the return type of fetch(...) can't be inferred by static analysis and developer tooling.
- Kwantuum 4y ago> the type of fetch() can't be inferred by static analysis That is preposterous.
- Cpoll 4y agoIt's not. One might assume it's Node fetch, but parent post was just using a specific example to make a general point. Fetch can be `any`thing. Would you say the same thing about function getData() { return mysteryFunction(…); }