title: optional parameters in typescript?
body: <p>Just new to typescript in an angular context. Can you mark properties as optional in the example below? How would you recommend specifying a nav item has no children? With regular JS I would usually rely on a falsey value to check if the object has <code>children</code> property. But in Typescript is it best practice to initialise an empty array? What about other primitive properties that may/may not have values?</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  
  export class NavItem {
    key: string;
    text: string;
    target: string;
    children: NavItem[];
  }
  
  const data: NavItem[] = [
    {
      key: "dashboard",
      target: "dashboard",
      text: "Dashboard",
      children: []
    },
    {
      key: "sales",
      target: "sales",
      text: "Sales"
    }
  ];
  
  @Injectable()
  export class NavService {
    getNav() {
      return data;
    }
  
  }
  </code></pre>