title: Read strongly typed yaml file in Typescript?
body: <p>I have the following <code>yaml</code> file:</p>
  <pre class="lang-yaml prettyprint-override"><code>trainingPhrases:
  - help me
  - what to do
  - how to play
  - help
  </code></pre>
  <p>I readi it from disk using <code>readFile</code> from node and parse it using <code>load</code> from <code>js-yaml</code>:</p>
  <pre class="lang-js prettyprint-override"><code>import { load } from &quot;js-yaml&quot;;
  import { readFile } from &quot;fs/promises&quot;;
  
  const phrases = load(await readFile(filepath, &quot;utf8&quot;)).trainingPhrases as string[];
  </code></pre>
  <p>I get the following <code>eslint</code> warning:</p>
  <pre><code>ESLint: Unsafe member access .trainingPhrases on an any value.(@typescript-eslint/no-unsafe-member-access)
  </code></pre>
  <p>Instead of suppressing the warning, I would like to map it into a concrete type for the YAML file (as it happens in axios for example: <code>axios.get&lt;MyResponseInterface&gt;(...)</code> - performs a <code>GET</code> and <code>MyResponseInterface</code> defines the structure of the HTTP response).</p>
  <p>Is there a dedicated library for that?</p>