# Typescript: Rust's non-biological brother

## Why did I start learning it?

I embarked on my journey with TypeScript on May 28, 2024, to contribute to the [Jam Project](https://jamapp.org/) as part of the [Summer of Bitcoin](https://www.summerofbitcoin.org/) 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!

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

let output = identity<string>("myString");
let output2 = identity("myString");  // Type inference
```

```rust
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](https://www.mediafire.com/file/0reeprz26clp3ok/Typescript_Cheat_Sheets.pdf/file)
