That looks really ugly to me. You have to read it left, right, left right, left, right.
You'll probably also lose all typing information if you do it like this (although TypeScript already can type a lot of stupid Javascript idioms).
It's not a stupid idiom, it's just passing an array to an async function and receiving an array as a return value. If it's easier for you, you can type
const getAllStatesPromise = GetAllStates(); const fetchAddressTypesPromise = FetchAddressTypes(); const findPhoneTypesPromise = FetchPhoneTypes(); const promisesToAwait = [ getAllStatesPromise, fetchAddressTypesPromise, findPhoneTypesPromise ]; const resolvedPromises = await Promise.all(promisesToAwait); const states = resolvedPromises[0]; const addressTypes = resolvedPromises[1]; const phoneTypes = resolvedPromises[2];
but why would you want to do that???
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That looks really ugly to me. You have to read it left, right, left right, left, right.
You'll probably also lose all typing information if you do it like this (although TypeScript already can type a lot of stupid Javascript idioms).
It's not a stupid idiom, it's just passing an array to an async function and receiving an array as a return value. If it's easier for you, you can type
but why would you want to do that???