Is anyone else interested in earning the Reader badge?

Personally, I’d create an interface to describe the data we expect from the database and then use one pipe / map to convert it:

export interface Author {
  name: string;
  students: string[];
  isPremium: boolean;
}
...
  author$: Observable<Author>;
  constructor(db: AngularFireDatabase) {
    this.author$ = db.object('/authors/1')
      .valueChanges()
      .pipe(map(a => a as Author));
  }

Something like that. Full disclosure: I just typed that out here without checking in an IDE or anything. No guarantees it will work, just trying to point you in the right direction.

The error about it returning an Observable<unknown> means you could also just map from unknown to any and then type as Observable<any>.

2 Likes

Unfortunately, every time you type as any we are basically losing any benefit to using Typescript since we know nothing about the type that it can use to help prevent issues. I have mostly programmed in Java so I may have a bias towards strongly typed languages.

2 Likes

Just for a data point: the longest thread I could find only had 44 so we are getting close to being the longest thread.

3 Likes

Thank you so much, I’ll modify my code whenever I get back home!

We are now on the longest thread then :slight_smile:

1 Like

Indeed, that’s what I thought too, but sometimes it is so hard to make things work ^^’
Working on it though!

I feel like that deserves a small celebration. :partying_face: :tada:

3 Likes

A big part of the issue is working with legacy libraries that predate Typescript (so they do not have good typing at their interface, just returning some JSON object). There are also methods which cannot do much better typing. For example, making an HTTP Get call - how do you type the return?

I suspect that is why some have typed with unknown rather than any since it forces you to pick something useful to treat it as.

2 Likes

I hope it actually works…

2 Likes

I put the “half” milestone as 50th reply.
Yeah you’re right it goes faster than I thought. :grin:

It certainly does, and I do not mind if it takes several weeks. The badge is impossible to achieve currently and this is as good a way as any in my opinion.

2 Likes

Hey! Thanks for putting it :slight_smile:

Hi again! Saw nothing really happened so I try to make it work again!
Hope you are doing well :slight_smile:

Yeah, gotta have replies to get some bantar going.

3 Likes

Oddly enough, I also find these badge systems enjoyable at work. My company has a just for fun badge collection system (anyone can make and give out badges for any reason). It is a fun way to break up some of the monotony at work.

3 Likes

To spice things up a bit, here’s a question: what is your favorite thing about Mosh’s teaching?

2 Likes

We can have another party post when we hit 75.

3 Likes

Yes gamification is an interesting thing. It first came AFAIK into game platforms such as Steam. As a player in between the casual and try-hard I hardly ever complete those but it still gives me some extra stuff to try.

There are 3 people in particular from those I know.

  • Mosh
  • Bogdan Staschuk
  • Dmitri Nesteruk

I think I put them in order of preference.
I know them all from Udemy.
Dmitri Nesteruk is a very knowledgeable Quant that provide advanced information. The drawback is I often postpone if not give up on his courses because of that even though I like it. Simply it is a bit too soon.

Bodgan is going in depth in his topics. He really gives a ton of information. The thing I like less though is the huge amount of repetition. Though repetition is good for memorizing/learning, when one consume his courses the way I do this is pretty tiring. His courses are probably made to be consumed bit by bit at a slower pace. I think many hours of his courses are mere repetition.

Mosh is kinda like reading my mind. He answers questions pretty much as soon as I have them. It seems we are focusing on the same bits of information and he is just providing it to us. Sure many complain about courses being outdated and to some extent I can understand. Also there are a few hiccups here and there such as showing a working result yet in practice it doesn’t but the answer actually appears on the next video (that React course and a few others). In these moment I heat search engines like crazy often not finding a solution until I give up on trying to find and play the next one. That one would have explained it to me. :sweat_smile: But overall I love the way he teaches. The courses are comprehensive.

I can understand keeping courses up to date on many techs may feel cumbersome, but from time to time (like every 3/5 years) they deserve an update or new course if suitable. I learned ASP .NET MVC with Mosh yet I learned ASP .NET Core building from that.

Oh Bonus awesome guy who probably would kick Nesteruk from the top 3. Rahul Nath has a Youtube channel where he presents various technologies in which .NET Core. I think I got my understanding of more advanced topics from him.

Extra question: What are you working on now ?

I am following the Learning path for .NET MAUI on Microsoft Learn.