Live data from Hacker News

Stop giving code examples in TypeScript

steverydz.com

11–14 of 14 posts

Re: Stop giving code examples in TypeScript

#11
post #8

> About 10 years ago we had a similar problem with jQuery. Often you would go to Stack Overflow to find the answer to a JavaScript problem you were having only to find the answer was given in jQuery. I don't understand this argument. TypeScript is just JS + type annotations — you should be able to boil away any fluff and be left with functioning JS. Whereas jQuery has actual runtime logic that would need to be rework…

Type annotations can add a lot of noise to the code if you don't understand what they are. Bear in mind I'm talking about someone trying to learn something. If they don't know TS you're expectng them to boil code they don't understand down to its essence.

In regards to the jQuery comparison, I'm not suggesting that someone would ask such a question of TS. All I'm saying is that there was an expectation that everything should be done in jQuery at the time.

Re: Stop giving code examples in TypeScript

#12
post #8

> About 10 years ago we had a similar problem with jQuery. Often you would go to Stack Overflow to find the answer to a JavaScript problem you were having only to find the answer was given in jQuery. I don't understand this argument. TypeScript is just JS + type annotations — you should be able to boil away any fluff and be left with functioning JS. Whereas jQuery has actual runtime logic that would need to be rework…

Type annotations can add a lot of noise to the code if you don't understand what they are. Bear in mind I'm talking about someone trying to learn something. If they don't know TS you're expectng them to boil code they don't understand down to its essence. In regards to the jQuery comparison, I'm not suggesting that someone would ask such a question of TS. All I'm saying is that there was an expectation that everythin…

The author! Hello

> Bear in mind I'm talking about someone trying to learn something. If they don't know TS you're expectng them to boil code they don't understand down to its essence.

I agree with this, but only for people who are new to the JS language, and the content targeting them.

People using JS regularly should be able to separate out TS noise, and asking the world to avoid TS for _every_ piece of knowledge content sounds like hyperbole.

> In regards to the jQuery comparison, I'm not suggesting that someone would ask such a question of TS. All I'm saying is that there was an expectation that everything should be done in jQuery at the time.

Then why include it in your argument?

Re: Stop giving code examples in TypeScript

#13
post #9

> TypeScript has a steep learning curve Does TS have a steep learning curve, or just a steep config curve? I personally feel that once a project has TS up & running, the actual use of it can be straightforward. Inference is so good these days, you shouldn't see many actual types at all in your code. Have I just been using it too long, and I've forgotten the initial pain?

TypeScript is a great example of "low floor, high ceiling" (a phrase used by Seymour Papert to describe LOGO). It's easy for beginners to get started (low floor) since their JS code works as is. They can then learn and apply increasingly sophisticated features over time (high ceiling).

Re: Stop giving code examples in TypeScript

#14
post #12

Earlier quoted context omitted.

Type annotations can add a lot of noise to the code if you don't understand what they are. Bear in mind I'm talking about someone trying to learn something. If they don't know TS you're expectng them to boil code they don't understand down to its essence. In regards to the jQuery comparison, I'm not suggesting that someone would ask such a question of TS. All I'm saying is that there was an expectation that everythin…

The author! Hello > Bear in mind I'm talking about someone trying to learn something. If they don't know TS you're expectng them to boil code they don't understand down to its essence. I agree with this, but only for people who are new to the JS language, and the content targeting them. People using JS regularly should be able to separate out TS noise, and asking the world to avoid TS for _every_ piece of knowledge c…

> People using JS regularly should be able to separate out TS noise, and asking the world to avoid TS for _every_ piece of knowledge content sounds like hyperbole.

I have worked with junior developers who struggle with this. I am not suggesting that all knowledge has to avoid TS, only that which isn't related to it. People who are new to the language want and need to learn _actual_ JS.

It's easy to not see this as a problem when you already know TS. Yes, it is clear what TS is once you know it. Imagine not knowing TS or the concept you are trying to learn about. What part of this is TS? What part of it is the information I am trying to find?

> Then why include it in your argument?

I was simply illustrating that there can be a tendency to assume knowledge which isn't relevant to the problem being solved.

Post reply on HN