As per the supported runtime for different languages in https://support.leetcode.com/hc/en-us/articles/360011833974-What-are-the-environments-for-the-programming-languages-, I am using https://github.com/datastructures-js/priority-queue#fromarray as this is a function of the supported library.
However, when I use
const maxHeap = MaxPriorityQueue.fromArray(nums);
I get an error
Line 11 in solution.js
const maxHeap = MaxPriorityQueue.fromArray(nums);
^
TypeError: MaxPriorityQueue.fromArray is not a function
Line 11: Char 36 in solution.js (findKthLargest)
Line 34: Char 19 in solution.js (Object.<anonymous>)
Line 16: Char 8 in runner.js (Object.runner)
Line 23: Char 26 in solution.js (Object.<anonymous>)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
This is in accordance with the example provided https://github.com/datastructures-js/priority-queue#js-3