Skip to content

Commit

Permalink
fix: thisreference
Browse files Browse the repository at this point in the history
Was broken via mtth#469
  • Loading branch information
joscha authored Oct 9, 2024
1 parent 5db1165 commit 4a443ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ function generateProjectionIndexer(projectionFn) {
};
}

function generateDefaultIndexer(types) {
function generateDefaultIndexer(types, self) {
const dynamicBranches = [];
const bucketIndices = {};

Expand Down Expand Up @@ -1271,7 +1271,7 @@ function generateDefaultIndexer(types) {
} else {
let bucket = getTypeBucket(type);
if (bucketIndices[bucket] !== undefined) {
throw new Error(`ambiguous unwrapped union: ${j(this)}`);
throw new Error(`ambiguous unwrapped union: ${j(self)}`);
}
bucketIndices[bucket] = index;
}
Expand Down Expand Up @@ -1314,7 +1314,7 @@ class UnwrappedUnionType extends UnionType {
}
this._getIndex = _projectionFn
? generateProjectionIndexer(_projectionFn)
: generateDefaultIndexer(this.types);
: generateDefaultIndexer(this.types, this);

Object.freeze(this);
}
Expand Down

0 comments on commit 4a443ac

Please sign in to comment.