2

Typescript manual mentions that we almost always must use the primitive types, but doesn't explain the reason behind it:

It can be tempting to think that the types Number, String, Boolean, Symbol, or Object are the same as the lowercase versions recommended above. These types do not refer to the language primitives however, and almost never should be used as a type.

https://www.typescriptlang.org/docs/handbook/basic-types.html#about-number-string-boolean-symbol-and-object
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#number-string-boolean-symbol-and-object

If we shouldn't use them, then why are they even exist?

Can you elaborate it please?

beatrice
  • 3,684
  • 5
  • 22
  • 49

0 Answers0