Why Typescript is Better than JavaScript for Team Projects

The Unending Debate: Why Use Typescript?

It always upsets me when I come across a person or an article that is strongly anti-Typescript. I find it extremely difficult to understand why a tool that does so much good in larger applications shared by multiple developers can be so detested…

Yet there are countless articles refuting the usefulness of Typescript, and refusing to acknowledge its benefits or the time-saving effect of having the limits and automatic self-documentation that Typescript enforces. These restrictions and tools enhance your code base, making it easy for other developers to contribute.

Typescript, used effectively, results in code that is:

  • More manageable and readable
    With good settings, Typescript ensures that code intention becomes explicit. Looking at the code, you will immediately understand what it is intended to do.

    It is definitely easy to get wrong at first. But, like any other coding language you’ve learned, you just need to get better by making mistakes, fixing them, and then trying again.

    One mistake that neophyte Typescript developers make is trying to add types to everything. Typescript inference is incredible. If you don’t try to force it, you’ll often find that Typescript provides types passively and you get to benefit.

  • Easier to understand
    This is a lot like the previous point, but importantly, you’ll find that as Typescript hints about the little mistakes that you make, you’ll gradually continue to improve the quality of your code automatically.

    In fact, I will argue that as you push through the first stages of Typescript, you’ll begin to truly understand what is happening under the hood of your Javascript code. You will become clearer about how your code works.

  • Better supported by IDEs
    IDEs like Visual Studio, VS Code, and Rider all play very well with Typescript. In a larger-sized Javascript code base, it can be difficult to use refactoring and developer convenience tooling.

    If you do nothing more than install Typescript, set up tsconfig.json, and change your extensions to .ts, Typescript will first give you a hard time about your Javascript typing issues, and then once you’ve addressed the issues you’ll find that your IDE magically knows a lot more about your project than it did before.

  • Less Buggy
    There isn’t a programming language that allows us to write code that has no possibility of mistakes, accidents, or bugs. However, Typescript adds a layer of security that can help to prevent many of them.
  • More Transferrable
    While there are many factors that make your code reusable and transferrable from project to project, being able to place your strongly typed code into a library will give it self-documentation along with the portability we all love, which will allow you to easily use it in other projects for many years to come without having to try to keep all your code memorized.

    JSDoc is still helpful, but knowing exactly what type of data your package expects in a function call will be a big time saver over the many reuses of a package.

💡 Note: Portability is something an open-source toolchain like Bit can help with. With Bit, you can identify and isolate components within your codebase, defining them as independent entities that can be developed and tested separately, then versioned, documented, and shared via a central registry. Learn more here.

Arguments Against Typescript:

  • Makes Code More Difficult to Read
    Yes, this can definitely be a problem when you use Typescript incorrectly or don’t yet understand it. However, this is not exclusive to Typescript. You can make nearly as many mistakes in Javascript that make your code ridiculously difficult to read.

    It takes a little time and effort to learn to use the tool effectively, then it increases readability — especially over a larger code base.

  • Makes Code More Difficult to Write
    Initially, when you’re learning Typescript, this is certainly true for most developers. It’s just as easy to learn as Javascript was in the beginning. In fact, you caught a break learning Javascript first and having time to absorb and learn the basics of programming through the flexible Javascript language. Typescript can be a level-up and usually very much worth it when your code base is large enough.
  • I Can’t do the Same Things in Typescript that I can in Javascript
    That’s by design. Typescript goes to great efforts to keep track of the data types in your code to help you avoid accidental errors — or for that matter potentially buggy logic on purpose which might otherwise result in errors that are very difficult to trace.
  • Typescript is Hard to Learn
    For some people, learning to drive a vehicle is difficult, or to ride a bike. Yes, it can be difficult, but it’s worth the effort. The benefits far outweigh the effort, and I don’t only mean the benefits in your code. Knowing how to wield Typescript effectively can directly impact your marketability and salary range.
  • It’s a LOT of Extra Work to Implement Typescript When I can Just use Javascript Directly.
    If your code base is really small, you’re not wrong. I won’t argue here.

    But the reality is that when you are working on a project that has code in more than a handful of files and you are working with a team of more than one person, Typescript is an investment that pays large dividends over time.

    I also think that when you know Typescript well enough, it will save you a great deal of time using it on a solo project too. I certainly do.

💡 This is where Bit is once again going to be useful. It provides a platform for sharing and collaborating on code components. It allows you to publish and share your custom library with other developers and teams, and easily manage versioning, dependencies, and updates.

Learn more here:

Create components | Bit

Is It The Perceived Difficulty of Learning Typescript that’s Holding You Back?

Are you just intimidated by having to learn Typescript?

Are you just not willing to learn it right now for your current project because you can’t see the justification in the extra work to learn and apply it?

Are you perhaps thinking that it is faster and more immediate to just do it in Javascript where you’re comfortable right now?

Whatever your reason, whatever your goals, if you don’t know Typescript well, then you owe it to yourself to at least learn it before you completely discard it. If you’ve tried to learn it and failed; or, if you’ve “tried” learning it for a few minutes or a few hours and haven’t given it an honest chance to see the benefit yet; take a little while to understand what to do and what NOT to do in Typescript.

There are many online resources to help you learn.

Check out the Typescript Docs. Also, look at Typescript Tooling in 5 minutes. If you’re feeling particularly adventuresome, find a Youtube course.

I will regularly publish articles here about TypeScript, JavaScript, other programming concepts, and high-level coding ideas.

Thank you for reading. Catch you next time!

Build Apps with reusable components, just like Lego

Bit’s open-source tool help 250,000+ devs to build apps with components.

Turn any UI, feature, or page into a reusable component — and share it across your applications. It’s easier to collaborate and build faster.

Learn more

Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:

Micro-Frontends

Design System

Code-Sharing and reuse

Monorepo

Learn more:


Why Typescript is Better than JavaScript for Team Projects was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Bits and Pieces - Medium and was authored by James Marks

The Unending Debate: Why Use Typescript?

It always upsets me when I come across a person or an article that is strongly anti-Typescript. I find it extremely difficult to understand why a tool that does so much good in larger applications shared by multiple developers can be so detested…

Yet there are countless articles refuting the usefulness of Typescript, and refusing to acknowledge its benefits or the time-saving effect of having the limits and automatic self-documentation that Typescript enforces. These restrictions and tools enhance your code base, making it easy for other developers to contribute.

Typescript, used effectively, results in code that is:

  • More manageable and readable
    With good settings, Typescript ensures that code intention becomes explicit. Looking at the code, you will immediately understand what it is intended to do.

    It is definitely easy to get wrong at first. But, like any other coding language you’ve learned, you just need to get better by making mistakes, fixing them, and then trying again.

    One mistake that neophyte Typescript developers make is trying to add types to everything. Typescript inference is incredible. If you don’t try to force it, you’ll often find that Typescript provides types passively and you get to benefit.
  • Easier to understand
    This is a lot like the previous point, but importantly, you’ll find that as Typescript hints about the little mistakes that you make, you’ll gradually continue to improve the quality of your code automatically.

    In fact, I will argue that as you push through the first stages of Typescript, you’ll begin to truly understand what is happening under the hood of your Javascript code. You will become clearer about how your code works.
  • Better supported by IDEs
    IDEs like Visual Studio, VS Code, and Rider all play very well with Typescript. In a larger-sized Javascript code base, it can be difficult to use refactoring and developer convenience tooling.

    If you do nothing more than install Typescript, set up tsconfig.json, and change your extensions to .ts, Typescript will first give you a hard time about your Javascript typing issues, and then once you’ve addressed the issues you’ll find that your IDE magically knows a lot more about your project than it did before.
  • Less Buggy
    There isn’t a programming language that allows us to write code that has no possibility of mistakes, accidents, or bugs. However, Typescript adds a layer of security that can help to prevent many of them.
  • More Transferrable
    While there are many factors that make your code reusable and transferrable from project to project, being able to place your strongly typed code into a library will give it self-documentation along with the portability we all love, which will allow you to easily use it in other projects for many years to come without having to try to keep all your code memorized.

    JSDoc is still helpful, but knowing exactly what type of data your package expects in a function call will be a big time saver over the many reuses of a package.
💡 Note: Portability is something an open-source toolchain like Bit can help with. With Bit, you can identify and isolate components within your codebase, defining them as independent entities that can be developed and tested separately, then versioned, documented, and shared via a central registry. Learn more here.

Arguments Against Typescript:

  • Makes Code More Difficult to Read
    Yes, this can definitely be a problem when you use Typescript incorrectly or don’t yet understand it. However, this is not exclusive to Typescript. You can make nearly as many mistakes in Javascript that make your code ridiculously difficult to read.

    It takes a little time and effort to learn to use the tool effectively, then it increases readability — especially over a larger code base.
  • Makes Code More Difficult to Write
    Initially, when you’re learning Typescript, this is certainly true for most developers. It’s just as easy to learn as Javascript was in the beginning. In fact, you caught a break learning Javascript first and having time to absorb and learn the basics of programming through the flexible Javascript language. Typescript can be a level-up and usually very much worth it when your code base is large enough.
  • I Can’t do the Same Things in Typescript that I can in Javascript
    That’s by design. Typescript goes to great efforts to keep track of the data types in your code to help you avoid accidental errors — or for that matter potentially buggy logic on purpose which might otherwise result in errors that are very difficult to trace.
  • Typescript is Hard to Learn
    For some people, learning to drive a vehicle is difficult, or to ride a bike. Yes, it can be difficult, but it's worth the effort. The benefits far outweigh the effort, and I don’t only mean the benefits in your code. Knowing how to wield Typescript effectively can directly impact your marketability and salary range.
  • It’s a LOT of Extra Work to Implement Typescript When I can Just use Javascript Directly.
    If your code base is really small, you’re not wrong. I won’t argue here.

    But the reality is that when you are working on a project that has code in more than a handful of files and you are working with a team of more than one person, Typescript is an investment that pays large dividends over time.

    I also think that when you know Typescript well enough, it will save you a great deal of time using it on a solo project too. I certainly do.
💡 This is where Bit is once again going to be useful. It provides a platform for sharing and collaborating on code components. It allows you to publish and share your custom library with other developers and teams, and easily manage versioning, dependencies, and updates.

Learn more here:

Create components | Bit

Is It The Perceived Difficulty of Learning Typescript that’s Holding You Back?

Are you just intimidated by having to learn Typescript?

Are you just not willing to learn it right now for your current project because you can’t see the justification in the extra work to learn and apply it?

Are you perhaps thinking that it is faster and more immediate to just do it in Javascript where you’re comfortable right now?

Whatever your reason, whatever your goals, if you don’t know Typescript well, then you owe it to yourself to at least learn it before you completely discard it. If you’ve tried to learn it and failed; or, if you’ve “tried” learning it for a few minutes or a few hours and haven’t given it an honest chance to see the benefit yet; take a little while to understand what to do and what NOT to do in Typescript.

There are many online resources to help you learn.

Check out the Typescript Docs. Also, look at Typescript Tooling in 5 minutes. If you’re feeling particularly adventuresome, find a Youtube course.

I will regularly publish articles here about TypeScript, JavaScript, other programming concepts, and high-level coding ideas.

Thank you for reading. Catch you next time!

Build Apps with reusable components, just like Lego

Bit’s open-source tool help 250,000+ devs to build apps with components.

Turn any UI, feature, or page into a reusable component — and share it across your applications. It’s easier to collaborate and build faster.

Learn more

Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:

Micro-Frontends

Design System

Code-Sharing and reuse

Monorepo

Learn more:


Why Typescript is Better than JavaScript for Team Projects was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Bits and Pieces - Medium and was authored by James Marks


Print Share Comment Cite Upload Translate Updates
APA

James Marks | Sciencx (2023-03-13T09:47:45+00:00) Why Typescript is Better than JavaScript for Team Projects. Retrieved from https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/

MLA
" » Why Typescript is Better than JavaScript for Team Projects." James Marks | Sciencx - Monday March 13, 2023, https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/
HARVARD
James Marks | Sciencx Monday March 13, 2023 » Why Typescript is Better than JavaScript for Team Projects., viewed ,<https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/>
VANCOUVER
James Marks | Sciencx - » Why Typescript is Better than JavaScript for Team Projects. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/
CHICAGO
" » Why Typescript is Better than JavaScript for Team Projects." James Marks | Sciencx - Accessed . https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/
IEEE
" » Why Typescript is Better than JavaScript for Team Projects." James Marks | Sciencx [Online]. Available: https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/. [Accessed: ]
rf:citation
» Why Typescript is Better than JavaScript for Team Projects | James Marks | Sciencx | https://www.scien.cx/2023/03/13/why-typescript-is-better-than-javascript-for-team-projects/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.