Typescript primitive types: any difference between the types “number” and “Number” (is TSC case-insensitive)?

To augment Ryan’s answer with guidance from the TypeScript Do’s and Don’ts:

Don’t ever use the types Number, String, Boolean, Symbol, or Object These types refer to non-primitive boxed objects that are
almost never used appropriately in JavaScript code.

/* WRONG */
function reverse(s: String): String;

Do use the types number, string, boolean, and symbol.

/* OK */
function reverse(s: string): string;

Leave a Comment