Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

type check array typescript

if (Array.isArray(value)) {
   var somethingIsNotString = false;
   value.forEach(function(item){
      if(typeof item !== 'string'){
         somethingIsNotString = true;
      }
   })
   if(!somethingIsNotString && value.length > 0){
      console.log('string[]!');
   }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #type #check #array #typescript
ADD COMMENT
Topic
Name
6+7 =