Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What was it like to learn TypeScript? #283

Closed
ErikSchierboom opened this issue Oct 3, 2019 · 6 comments
Closed

What was it like to learn TypeScript? #283

ErikSchierboom opened this issue Oct 3, 2019 · 6 comments

Comments

@ErikSchierboom
Copy link
Member

We’ve recently started a project to find the best way to design our tracks, in order to optimize the learning experience of students.

As a first step, we’ll be examining the ways in which languages are unique and the ways in which they are similar. For this, we’d really like to use the knowledge of everyone involved in the Exercism community (students, mentors, maintainers) to answer the following questions:

  1. How was your experience learning TypeScript? What was helpful while learning TypeScript? What did you struggle with? How did you tackle problems?
  2. In what ways did TypeScript differ from other languages you knew at the time? What was hard to learn? What did you have to unlearn? What syntax did you have to remap? What concepts carried over nicely?

Could you spare 5 minutes to help us by answering these questions? It would greatly help us improve the experience students have learning TypeScript :)

Note: this issue is not meant as a discussion, just as a place for people to post their own, personal experiences.

Want to keep your thoughts private but still help? Feel free to email me at erik@exercism.io

Thank you!

@peerreynders
Copy link
Contributor

peerreynders commented Nov 23, 2020

Just recently it was (ironically) two "difficulty: 2" exercises that I was rounding up as stragglers after doing numerous side exercises that unexpectedly served a "eureka! moment". In particular:

Sure they are larger than the typical JavaScript inspired solutions but the "bloat" is largely related to type information.

What is unusual with TypeScript (and I haven't seen much calling attention to) is the amount of code that deals with type extraction rather than type declaration compared to typical statically typed programming languages. That realization leads to a coding style that maximizes capturing information relevant to typing in constant literals so that:
a.) it's easy to direct TypeScript to access/extract it as necessary
b.) repetition of type literal values is kept to a minimum

PS: Thank You for all your efforts!

@SleeplessByte SleeplessByte pinned this issue Dec 15, 2020
@neenjaw
Copy link
Contributor

neenjaw commented Jan 1, 2021

I started learning typescript during a brief dalliance with angular 2, but set it down as I didn't want to commit to angular 2. I then picked it up earlier this year to convert a script I wrote in JavaScript to TypeScript.

I think at first I wanted to type everything, and probably spent too much time specifying types explicitly. I think I have learned to allow TS to infer a lot more types, or used it's helper functions to extract types rather than explicitly setting them myself.

TypeScript differs from JavaScript because once you get the hang of it, it makes development really fast. You don't have to run something to discover that you have a clashing datatype from a function call. It makes it so you spend more time thinking about how to write your code nicely rather than debugging stack traces or undefined behavior from an unexpected type.

I don't think I had to remap or unlearn syntax, I think there are definately new syntaxes to learn but I think that is mostly learning how to apply typescript ideas to javascript code.

@SaschaMann
Copy link
Contributor

How was your experience learning TypeScript?

I never tried to learn it "properly" but picked it up by looking at existing code bases and adapting them to the problem I had to solve. It was a pretty miserable experience because a lot of things don't work as I naïvely expected them to and because even basic TS projects come with an absurd amount of config files and tooling that is never explained or justified by the projects themselves. It appears this is something one is just meant to know when working with TS.

What was helpful while learning TypeScript?

@SleeplessByte reviewing and fixing my mistakes and setting up a proper project template :D

What did you struggle with?

See above. The mix of async vs sync functions is quite confusing. Library docs don't tend to explain why something is sync or async. I found a lot of tutorials/examples that presented several ways to do something but never explained how one is meant to know which one to use.

How did you tackle problems?

Looking at how the code I adapted solved the issues, as well as web searches that inevitably lead to poorly written Medium blog posts rather than actual documentation or manuals. Then later by asking @SleeplessByte directly.

In what ways did TypeScript differ from other languages you knew at the time?

It's the extreme opposite of "one way to do things", also for tooling. There's no standardised docs layout/format, each library does its own thing.

What was hard to learn?

See above.

What did you have to unlearn?

That things "just work" as I would intuitively expect them to.

What syntax did you have to remap?

That equality is not equality.

What concepts carried over nicely?

Overall the syntax is easy to read with previous experience in a C-style syntax language, so it's fairly easy to figure out the broad idea of what a snippet of code does even if the details and implications are not obvious.

@ErikSchierboom
Copy link
Member Author

How was your experience learning TypeScript?

I loved it. It was well-documented from the start. Had great tooling and made my day to day work a lot more enjoyable.

What was helpful while learning TypeScript?

The official TypeScript document, as well as the TypeScript playground.

What did you struggle with?

Sometimes error messages could be slightly cryptic.

How did you tackle problems?

Mostly just trial and error and StackOverflow.

In what ways did TypeScript differ from other languages you knew at the time?

I was not used to languages having optional typing. You can start with using any everywhere and then gradually introduce types.

That TypeScript compiled to JavaScript was also a first for me at the time. This made integrating it into existing projects slightly more challenging.

TypeScript was also progressing at a really fast pace, so I had to make an effort to keep up with the latest changes.

What was hard to learn?

Some of the advanced type features.

What did you have to unlearn?

Not much

What syntax did you have to remap?

Relatively little. Most of it was very straightforward. I did have to remap that types are specified after the name of the parameter instead of the other way around.

What concepts carried over nicely?

Most of my C# and JavaScript knowledge carried over nicely.

@kntsoriano
Copy link

How was your experience learning TypeScript?

I never really learned it, but needed to pick it up during work. It was pretty hard for me as I wasn't used to declaring types as often. I come from a Ruby background.

What was helpful while learning TypeScript?

Getting lots of feedback from @SleeplessByte. I wouldn't know how to do otherwise.

What did you struggle with?

It was hard for me since error messages were hard to understand. Also, there were some null checks that I tried to implement, but the parser wasn't able to pick them up. It was also adapting Typescript to React and other libraries that didn't have type definitions which made it hard for me.

I didn't also use VSCode previously, which made it hard for me to see errors.

How did you tackle problems?

I really depended on my C background to construct types. I had a vague notion of what the types are and I just went ahead from there.

In what ways did TypeScript differ from other languages you knew at the time?

It had types and needed to be compiled. I'm pretty much enjoying it though, as I see errors a lot earlier.

What was hard to learn?

It was hard for me to learn the more advanced features such as unions or generics.

What did you have to unlearn?

Nothing really. I think I needed to unlearn being "lazy" and not determining what types I want for my functions.

What syntax did you have to remap?

I don't recall any.

What concepts carried over nicely?

Vague notions of types from my college programming class carried over nicely. My little Javascript knowledge helped a lot, too.

@ErikSchierboom
Copy link
Member Author

We're closing this issue as it was part of our research for the v3 version of Exercism which has just been released.

Thanks everyone for chipping in! It has been greatly appreciated.

@SleeplessByte SleeplessByte unpinned this issue Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants