DEV Community

Discussion on: TS Tip 💁‍♂️ Avoid the boilerplate with `typeof`

Collapse
 
stereoplegic profile image
Mike Bybee • Edited

TypeScript devs keep telling me that "nothing in TypeScript interferes with a junior dev's ability to learn JavaScript..."

Exhibit A:

"TypeScript uses the typeof keyword for capturing anonymous types. Despite the same name, it is very different from JavaScript's typeof operator — in fact, the two can only appear in mutually exclusive places."
-- Marius Schultz

Collapse
 
madyanalj profile image
Madyan

Agreed. I definitely think there is a steep learning curve for TS, especially when it comes to advanced typing concepts such as the one mentioned in this post and generics. I strongly believe it's worth it in the long term though, especially when you're authoring a library for others to use (whether the library users use TS or plain JS)

Collapse
 
stereoplegic profile image
Mike Bybee

I don't agree (especially when it comes to mixing annotations in with the function declarations themselves, and having seen the long term effects on both project organization firsthand, and on junior dev learning), but I understand the rationale.