From f84d5e6a7a1f532cff938970a6b4e7e1612ff59d Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Thu, 9 Jan 2025 14:52:31 -0800 Subject: [PATCH] fix: Add polyfill for set.union for node < 22 --- src/awst_build/models/contract-class-model.ts | 1 + src/polyfill/set.prototype.union.ts | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 src/polyfill/set.prototype.union.ts diff --git a/src/awst_build/models/contract-class-model.ts b/src/awst_build/models/contract-class-model.ts index 533af049..b2efdc28 100644 --- a/src/awst_build/models/contract-class-model.ts +++ b/src/awst_build/models/contract-class-model.ts @@ -15,6 +15,7 @@ import type { ContractClassPType } from '../ptypes' import { ClusteredContractClassType } from '../ptypes' import type { ContractOptionsDecoratorData } from './decorator-data' import { LogicSigClassModel } from './logic-sig-class-model' +import '../../polyfill/set.prototype.union' export class ContractClassModel { public readonly isAbstract: boolean diff --git a/src/polyfill/set.prototype.union.ts b/src/polyfill/set.prototype.union.ts new file mode 100644 index 00000000..35a245f2 --- /dev/null +++ b/src/polyfill/set.prototype.union.ts @@ -0,0 +1,5 @@ +if (!Set.prototype.union) { + Set.prototype.union = function union(this: Set, other: ReadonlySet) { + return new Set([...this, ...other]) + } +}