title: Add Objects to Array in function In TypeScript
body: <p>I have a Object with 12 booleans, I want get only the values true and insert in my ArrayList, but I get error.</p>
  
  <pre><code>let arrayMonths: Array&lt;string&gt; = function () {
      let array: Array&lt;string&gt;;
      let obKeys = Object.keys(this.months), prop: string;
  
      for (prop of obKeys) {
          if (this.months[prop]) {
              array.push(this.service.months[prop]);
          }
      }
      return array;
  }
  </code></pre>
  
  <p>error:</p>
  
  <blockquote>
    <p>"message": "The type '() => string []' can not be assigned to the type 'string []'. \ n The 'press' property is missing in the type '()
    => string []'." ,</p>
  </blockquote>