Use async/await with TypeScript in Cloud Functions for Firebase - Firecasts

preview_player
Показать описание
Using async/await syntax with Cloud Functions for Firebase can make your TypeScript and ECMAScript 2017 code easier to read and write. In this part 2 video, @CodingDoug shows how to convert some functions that use promises to use async/await instead. Does it look better to you? Let us know in the comments!

Рекомендации по теме
Комментарии
Автор

This video solves exactly the questions I was having lol. Great work

codinginflow
Автор

3.47 onwards is what I was looking for. Thank you, Doug.

yogenp
Автор

Very, very good video series. HIGH QUALITY, right on target!

sveinsoermo
Автор

Wow. Nicely explained. I finally get it now. I like the refactoring part. Thank you.

cindysi
Автор

This is a great video. And an area where TypeScript adds a lot of clarity to the development process.

SamBecker
Автор

How do you deal with the "snapshot.forEach" as specified in the documentation, because I am having problems with async await using that.

eduardooviedoblanco
Автор

Thanks for the video Doug. Good to see you're back from your Google Tel-Aviv improvised office, although your view there was better looking than the green screen backdrop :-)

noamgonen
Автор

That's super nice, the code looks a lot cleaner, thanks for the tip!

rammalvarez
Автор

When I do this I get red underlines in the editor when trying to access anything after snapshot.data(). I get an "Object is possibly 'undefined'" error. What am I doing wrong? Code and data structure is identical.

jlb
Автор

Loving these series! I had some doubts with Promises, now i know what i needed :) Thanks!

danvilela
Автор

It's really clear and useful. Save a lot of time for beginners like me.

saramandavid
Автор

#Error


- "Object is possibly 'undefined'.ts(2532)" error on line 9
- "Variable 'results' implicitly has type 'any[]' in some locations where its type cannot be determined.ts(7034)" error on line 17
and
- "Variable 'results' implicitly has an 'any[]' type.ts(7005)" on line 23
Anyone have the same problem or can help?

YousefKabbara
Автор

How is the javascript? cause currently I can't use async/await for javascript in cloud functions.

KyoKurosagi
Автор

Once again, absolutely brilliant! And very appreciative that you delivered on the time you committed. Admirable!!
But i still have 1 nagging problem. Inside my forEach there are processes where I need to use AWAIT. So, I made the forEach async. But it doesn't run more than once. Some say use "await Promise.all' with snapshot.map(...).
What's your best advice on handling a snapshot.forEach loop when there are AWAIT promises in every iteration?

lgopt
Автор

Variable 'promises' implicitly has type 'any[]' in some locations where its type cannot be determined, and areaSnapshot 'Object is possibly 'undefined'. How do I fix these errors?

sediavindivoh
Автор

Why would one use async/await vs then().catch()? Isn't the latter easier to test?

wwgg
Автор

Just wanted to say thanks! This was a very helpful series

akXIII
Автор

video tips using async/await for realtime database transaction also for firestore runTransaction in cloud functions.

rajarams
Автор

Awesome video! Exactly what I needed today to refactor some code. Keep these up

JOKBO
Автор

Hi Doug, some of the functions samples (like the audio ffmpeg conversion) still has the .js examples. Are there any plans to revamp the github examples to reflect .ts? Many thanks.

raghav