title: Inline a type definition in TypeScript
body: <p>I'm writing a type definition file (<code>index.d.ts</code>) for a jQuery library that doesn't come with a type definition.<br />
  The methods of that library repeatedly accept parameters of the same multi-type (<code>string | number | []</code>) so I defined it as a <code>CustomType</code>:</p>
  <pre class="lang-ts prettyprint-override"><code>export type CustomType = string | number | [];
  
  declare global {
      interface JQuery&lt;TElement = HTMLElement&gt; {
          setFoo(foo: CustomType): this;
          setBar(bar: CustomType): this;
      }
  }
  </code></pre>
  <p>When I now want to call <code>setFoo()</code> on a jQuery object, the type hinting (of IntelliJ) shows that a parameter <code>foo: CustomType</code> is expected which doesn't help fellow devs without looking up what that type resembles.<br />
  Instead I'd love to see the type hinting to show <code>foo: string | number | []</code>.</p>
  <p>For example, in C++ there is this concept of an <code>inline</code> function which basically tells the compiler to put the code of the inlined functions body right into the block where it's called rather than to call / jump to the function. Is there something similar in TypeScript?</p>
  <p><strong>How can I force TypeScript to inline this <code>CustomType</code> and make it show as <code>foo: string | number | []</code> instead of <code>foo: CustomType</code>?</strong></p>
  <h2>Ugly Solution</h2>
  <pre class="lang-ts prettyprint-override"><code>declare global {
      interface JQuery&lt;TElement = HTMLElement&gt; {
          setFoo(foo: string | number | []): this;
          setBar(bar: string | number | []): this;
      }
  }
  </code></pre>
  <p>One solution would be to eliminate the <code>CustomType</code> and explicitly type parameters with their multi-types, but this becomes rather inconvenient with an increasing number of methods that use the same type as it doesn't benefit from reusability plus it looks ugly to me.</p>
  <h2>Imaginary Solution</h2>
  <pre class="lang-ts prettyprint-override"><code>export type CustomType = string | number | [];
  
  declare global {
      interface JQuery&lt;TElement = HTMLElement&gt; {
          setFoo(foo: inline CustomType): this; // &lt;-- note the 'inline' here
          setBar(bar: inline CustomType): this;
      }
  }
  </code></pre>
  <p>This would be ideal and in my imagination behave like the 'Ugly Solution', but unfortunately isn't supported. So what would be the proper way to achieve this?</p>