Skip to content

Commit

Permalink
fix: build error
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 committed Oct 8, 2024
1 parent fd87130 commit baa80c6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-explicit-any */

// Extend the Set prototype to include isSubsetOf
interface Set<T> {
isSubsetOf(otherSet: Set<T>): boolean;
}

if (!Set.prototype.isSubsetOf) {
Set.prototype.isSubsetOf = function <T>(
if (!(Set.prototype as any).isSubsetOf) {
(Set.prototype as any).isSubsetOf = function <T>(
this: Set<T>,
otherSet: Set<T>,
): boolean {
for (let elem of this) {
// @ts-expect-error - TS doesn't know that this is a Set
for (const elem of this) {
// @ts-expect-error - TS doesn't know that otherSet is a Set
if (!otherSet.has(elem)) {
return false;
}
}
return true;
};
}

/* eslint-enable */

// Add an empty export statement to ensure it's treated as a module
export {};

0 comments on commit baa80c6

Please sign in to comment.