Skip to main content

Command Palette

Search for a command to run...

Typescript: Rust's non-biological brother

Updated
2 min read
S
Documenting my daily learnings as I prepare for SDE-1 roles at high-performance and HFT-focused companies. Passionate about systems, strong DSA, and building efficient backend infrastructure.

Why did I start learning it?

I embarked on my journey with TypeScript on May 28, 2024, to contribute to the Jam Project as part of the Summer of Bitcoin Internship program.

What do I mean by brother?

  1. Strong typing: Both languages emphasize static typing to catch errors at compile-time.

  2. Modern language features: They both incorporate modern programming concepts and syntax.

  3. Tooling and ecosystem: Both have robust tooling support and growing ecosystems.

  4. Safety focus: TypeScript and Rust prioritize writing safer code, albeit in different ways.

  5. Compiled languages: Both compile to a target language/format (TypeScript to JavaScript, Rust to machine code).

Huh, They are pretty similar in some traits and also share pretty much same syntax.

Here's a Basic Function using Generics in both languages!

function identity<T>(arg: T): T {
    return arg;
}

let output = identity<string>("myString");
let output2 = identity("myString");  // Type inference
fn identity<T>(arg: T) -> T {
    arg
}

let output = identity::<String>(String::from("myString"));
let output2 = identity("myString");  // Type inference

Can you notice the similarities? I mean WOW!

As a person coming from Rust and Typesafe languages, I was able to pickup Typescript very quickly and absolutely love it now.


Thanks for Reading my blog, this is the first one in series and I hope to continue it.

If you have come this far? Here's a gift for you 🎁

Typescript Cheat Sheet

More from this blog

Saksham's Blog on Learning

11 posts

I write about what I learn to become a high-paying quant dev!