message: fix(forge-site-parser): wrong type on Version object
diff: -import { parse as parseHtml, HTMLElement } from "node-html-parser";
  +import { parse as parseHtml, HTMLElement, Node } from "node-html-parser";
  /**
  * One forge version download info
  @@ -11,26 +11,7 @@ interface Download {
  function notnull<T>(v: T | undefined): v is T { return !!v }
  -/**
  - * Parse the html string of forge webpage
  - */
  -export function parse(content: string): ForgeWebPage {
  - const dom = parseHtml(content);
  - if (!(dom instanceof HTMLElement)) {
  - throw new SyntaxError("The content is not the HTML format.");
  - }
  - const selected = dom.querySelector(".elem-active");
  - if (!selected) {
  - throw new Error("Corrupted Forge Web Page");
  - }
  - const mcversion = selected.text;
  - return {
  - mcversion,
  - versions: dom.querySelector(".download-list")!.querySelector("tbody")!.querySelectorAll("tr")!
  - .map((e) => {
  - const links = e.querySelector(".download-links").childNodes
  - .filter((elem) => elem instanceof HTMLElement && elem.tagName === "li")
  - .map((elem) => {
  +function parseLink(elem: Node) {
  let e = (elem as HTMLElement).removeWhitespace();
  /*
  * <div class="info-tooltip">
  @@ -76,7 +57,25 @@ export function parse(content: string): ForgeWebPage {
  sha1,
  path: href,
  };
  - })
  +}
  +/**
  + * Parse the html string of forge webpage
  + */
  +export function parse(content: string): ForgeWebPage {
  + const dom = parseHtml(content);
  + if (!(dom instanceof HTMLElement)) {
  + throw new SyntaxError("The content is not the HTML format.");
  + }
  + const selected = dom.querySelector(".elem-active");
  + if (!selected) {
  + throw new Error("Corrupted Forge Web Page");
  + }
  + const mcversion = selected.text;
  +
  + function parseVersion(e: HTMLElement): Version {
  + const links = e.querySelector(".download-links").childNodes
  + .filter((elem) => elem instanceof HTMLElement && elem.tagName === "li")
  + .map(parseLink)
  .filter(notnull);
  const downloadVersionElem = e.querySelector(".download-version");
  let version;
  @@ -105,7 +104,7 @@ export function parse(content: string): ForgeWebPage {
  if (installer === undefined && universal === undefined) {
  throw new Error("Cannot parse forge web since it missing installer and universal jar info.");
  }
  - const result = {
  + const result: Version = {
  version,
  "date": e.querySelector(".download-time").text.trim(),
  changelog,
  @@ -120,7 +119,12 @@ export function parse(content: string): ForgeWebPage {
  };
  return result;
  - }),
  + }
  + const versions = dom.querySelector(".download-list")!.querySelector("tbody")!.querySelectorAll("tr")!
  + .map(parseVersion);
  + return {
  + mcversion,
  + versions,
  };
  }
  /**
  @@ -140,11 +144,12 @@ interface Version {
  * The changelog info
  */
  changelog?: Download;
  - installer: Download;
  + installer?: Download;
  mdk?: Download;
  - universal: Download;
  + universal?: Download;
  source?: Download;
  launcher?: Download;
  + ["installer-win"]: Download | undefined
  /**
  * The type of the forge release. The `common` means the normal release.
  