What’s wrong with that code?

Technology CommunityCategory: TypeScriptWhat’s wrong with that code?
VietMX Staff asked 3 years ago
Problem
// something is wrong
function reverse(s: String): String;

Don’t ever use the types NumberStringBoolean, or Object. These types refer to non-primitive boxed objects that are almost never used appropriately in JavaScript code. Instead of Object, use the non-primitive object type.

Consider:

function reverse(s: string): string;