title: Typescript types for empty map and array
body: <p>In typescript, how can I express that a function only accepts an empty map or array?</p>
  
  <p>Something like this (but it does not work):</p>
  
  <pre><code>function foo(emptyMapOrArray: {} | []) {
      //...
  }
  
  // This should error
  foo(["a"])
  foo({a: 1})
  // This should work
  foo([])
  foo({})
  </code></pre>
  
  <p>The use-case is that I want to be able to assign an "atomic" value to a part of a JSON document. Something like the cursor used in this <a href="http://arxiv.org/abs/1608.03960" rel="nofollow noreferrer">paper</a>. So a more complete example would be something like this:</p>
  
  <pre><code>function assign(map: {}, key: string, value: string | number | boolean | {} | []) {
    map[key] = value
  }
  </code></pre>
  
  <p>However I realised I can model the empty-map and empty-array as separate operations. But still I think it is interesting to know how expressive the type system in typescript can be in this case.</p>