TypeScript define object structure for later use
<p>Is it possible to define an object structure in TypeScript that can be used then as parameter type?</p>

<p>What I mean:<br>
I have <em>(let's say)</em> 5 functions that return the same object structure like so:</p>

<pre><code>foo(): { bar: string, baz: boolean, idk: number } { ... }
bar(): { bar: string, baz: boolean, idk: number } { ... }
...
</code></pre>

<p>the problem with this is that I have to define this structure at every function that returns an object like this. </p>

<p>So is it possible to do something like the following?</p>

<pre><code>declare const OBJECT_STRUCTURE: { bar: string, baz: boolean, idk: number }

foo(): OBJECT_STRUCTURE { ... }
bar(): OBJECT_STRUCTURE { ... }
...
</code></pre>