Check if a value is a string
JavaScript
const isString = (value) => Object.prototype.toString.call(value) === '[object String]'
TypeScript
const isString = (value: any): boolean => Object.prototype.toString.call(value) === '[object String]'
Examples
isString('hello world') // true
isString(new String('hello world')) // true
isString(10) // false