Skip to content

Commit

Permalink
remove wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Sep 29, 2024
1 parent bd2c6dd commit 9f6eaff
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,10 @@ class Type {
if (!UnionType) {
if (typeof opts.wrapUnions === 'function') {
// we have a projection function
try {
projectionFn = opts.wrapUnions(types);
UnionType = typeof projectionFn !== 'undefined'
? UnwrappedUnionType
: WrappedUnionType;
} catch(e) {
throw new Error(`Error generating projection function: ${e}`);
}
projectionFn = opts.wrapUnions(types);
UnionType = typeof projectionFn !== 'undefined'
? UnwrappedUnionType
: WrappedUnionType;
} else {
UnionType = isAmbiguous(types) ? WrappedUnionType : UnwrappedUnionType;
}
Expand Down Expand Up @@ -1319,11 +1315,7 @@ class UnwrappedUnionType extends UnionType {
super(schema, opts);

if (!_projectionFn && opts && typeof opts.wrapUnions === 'function') {
try {
_projectionFn = opts.wrapUnions(this.types);
} catch(e) {
throw new Error(`Error generating projection function: ${e}`);
}
_projectionFn = opts.wrapUnions(this.types);
}
this._getIndex = _projectionFn
? generateProjectionIndexer(_projectionFn)
Expand Down

0 comments on commit 9f6eaff

Please sign in to comment.