Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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