What should the return type of Promise race be Typescript

0 votes

For example in the code below, what should the type of response be? Typescript keeps giving me errors such as, Type 'unknown' is not assignable to type 'Promise'

const response: [what type???] = await Promise.race([
      apicall(),
      timeoutPromise(),
    ]);
Jul 5, 2022 in TypeSript by Logan
• 2,140 points
323 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In TypeSript

0 votes
1 answer

What is "not assignable to parameter of type never" error in TypeScript?

All you have to do is define ...READ MORE

answered May 31, 2022 in TypeSript by Nina
• 3,060 points
48,716 views
0 votes
1 answer
0 votes
1 answer

What is TypeScript and why would I use it in place of JavaScript?

TypeScript is a superset of JavaScript which primarily ...READ MORE

answered May 31, 2022 in TypeSript by Nina
• 3,060 points
317 views
0 votes
1 answer

What does the ! (exclamation mark) do in TypeScript?

The exclamation mark is called the non-null ...READ MORE

answered Jun 1, 2022 in TypeSript by Nina
• 3,060 points
932 views
0 votes
1 answer

TypeScript TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'

If you want a key/value data structure ...READ MORE

answered Jun 7, 2022 in TypeSript by Nina
• 3,060 points
14,325 views
0 votes
1 answer
0 votes
0 answers

What is a type in Typescript for the Component class in Angular 2+?

I have a small problem, but big ...READ MORE

Jul 5, 2022 in TypeSript by Logan
• 2,140 points
524 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP