title: Is there a TypeScript `Partial<any>` type for a function parameter to accept `any` but be `void`?
body: <p>For an interface, one can use <code>Partial&lt;X&gt;</code>, the <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html#mapped-types" rel="nofollow noreferrer">Mapped Type</a> to say "Permit all properties of X, but expect none of them".</p>
  
  <p>So that the following causes a compiler error:</p>
  
  <pre><code>interface X { foo: boolean }
  
  function doSomething(x: Partial&lt;X&gt;) {
    let aBoolean: boolean = x.foo; // ERROR: possibly undefined
  }
  
  doSomething({ foo: true }); // OK
  doSomething({}); // OK
  doSomething(true); // ERROR: Type 'boolean' has no properties in common with 'Partial&lt;X&gt;'
  </code></pre>
  
  <p>I would like to do the same thing with <code>any</code> to say "this function may accept anything as a parameter, but you can't count on anything being there"</p>
  
  <pre><code>function doSomething(x: Partial&lt;any&gt;) {
    let aBoolean: boolean = x.foo; // OK, but I wish it wasn't
  }
  
  doSomething({ foo: true }); // OK
  doSomething({}); // OK
  doSomething(true); // OK
  doSomething(/* etc. */); // OK
  </code></pre>
  
  <p>I would like my function to accept anything and everything as an argument, but inside the function I should not be able to access any properties on the object without checking for them first. It's even ok if inside the function <code>x</code> has type <code>void</code> or <code>never</code>.</p>
  
  <p>I'm not surprised <code>Partial&lt;any&gt;</code> doesn't work like I wish - I am definitely <em>not</em> asking "why doesn't <code>Partial&lt;any&gt;</code> work the way I wish it did". I'm asking: </p>
  
  <p><strong>What type can I use for the parameter <code>x</code> such that:</strong></p>
  
  <ol>
  <li>it accepts arguments of any/every type</li>
  <li>inside the function the type of <code>x</code> is something where every property is possibly undefined (or <code>x</code> is of type <code>void</code>, etc.)</li>
  </ol>