Avatar ·

What is the difference between String and string types in TypeScript?

Hello colleagues! I just started learning TypeScript and encountered an unclear situation. In some code examples, I see that `string` (lowercase) is used to declare a string variable, while in others — `String` (uppercase). For example: ```typescript let name1: string = "John"; let name2: String = "John"; ``` Both options work, and I don't see any difference in behavior. My code compiles without errors in both cases. But I feel this is not just a stylistic difference. I've heard somewhere that `String` is a class, while `string` is a primitive type, but I don't understand how this affects practical usage. Can someone explain what exactly the difference is? When should I use one option versus the other? Are there any pitfalls if I use