I have tried to write a small piece of code in typescript to read yaml file but unfortunately it is not working.
import { readFile } from 'fs/promises';
import { load } from 'js-yaml';
const filepath = 'src/commands/hello/test.yml';
const yaml = load(await readFile(filepath, "utf8")) as string;
const phrases = yaml.trainingPhrases;
console.log(phrases);
My yaml file
---
trainingPhrases:
- help me
- what to do
- how to play
- help