// @ts-ignore if (!Array.prototype.toSorted) { Object.defineProperty(Array.prototype, 'toSorted', { value: function (this: Array, compareFn?: (a: T, b: T) => number): Array { return [...this].sort(compareFn); }, writable: true, configurable: true, }); }