2023-06-19
1703
#typescript
Debjyoti Banerjee
171799
104
Jun 19, 2023 ⋅ 6 min read

Understanding TypeScript generators

Debjyoti Banerjee I'm Debjyoti, software engineer and game developer. Currently exploring JavaScript and Flutter, and trying to come up with solutions to problems in the healthcare sector. Love open source.

Recent posts:

Using React Shepherd To Build A Site Tour

Using React Shepherd to build a site tour

React Shepherd stands out as a site tour library due to its elegant UI and out-of-the-box, easy-to-use React Context implementation.

Onuorah Bonaventure
May 1, 2024 ⋅ 14 min read
A Guide To Cookies In Next Js

A guide to cookies in Next.js

Cookies are crucial to web development. This article will explore how to handle cookies in your Next.js applications.

Georgey V B
Apr 30, 2024 ⋅ 10 min read
Handling Dates In JavaScript With Tempo

Handling dates in JavaScript with Tempo

Use the Tempo library to format dates and times in JavaScript while accounting for time zones, daylight saying time, and date internationalization.

Amazing Enyichi Agu
Apr 30, 2024 ⋅ 8 min read
A Guide To Deno.cron

A guide to Deno.cron

This guide explores how to use the cron package in Deno, `Deno.cron`, to handle scheduling tasks with specific commands.

Rosario De Chiara
Apr 29, 2024 ⋅ 5 min read
View all posts

5 Replies to "Understanding TypeScript generators"

  1. An obscure feature of a language that has much bigger issues to deal with first. This is probably the fifth article I read about it, but I’ve never seen anyone actually use it in the wild, including me.

    1. I agree. And it’s gimmicky.
      As an article, it’s good; but as a dev pattern I could imagine one of my junior, programmers burning up hours—or even days or weeks—looking for clever ways to use this feature (a “clever” solution looking for the ideal problem) …only to have the next maintainer come along and rip it out for something more straightforward.

  2. I think this next() call:

    console.log(generator.next()); // Uncaught Error: Something went wrong

    Is not correct. That error doesn’t get thrown out of the generator because it is caught within the generator.

  3. Generators are a JavaScript language feature, not a Typescript feature. How can we take the author seriously if he doesn’t even know the most fundamental fact about the topic he’s discussing

    1. I think you need to chill out. It IS technically a feature in typescript too, as TS supports whatever JS supports, but really, does an author have to state the obvious for it to be taken seriously? Maybe people learn TS and not JS, or, maybe people don’t care.

Leave a Reply