When I first delved into the world of scripting languages, JavaScript felt manageable. However, things got confusing when I shifted my focus to Angular2 with TypeScript.
I soon discovered that TypeScript has the ability to define Built-In Types like string, number, and Objects, and when compiled, TypeScript transforms into JavaScript.
This is where my confusion set in - how does TypeScript handle Generic Types in a language like JavaScript, which relies on prototypes and lacks traditional Type definitions?
For instance, consider the challenge of translating the following code snippets into JavaScript:
interface Person {
name : string,
age : number
}
If anyone can shed light on this topic, I would greatly appreciate it. Scripting may be enjoyable, but it can also present some perplexing challenges at times. (^^)