Skip to content

Commit 48791db

Browse files
committed
fix: improve type simplification when intersecting
1 parent 24e3721 commit 48791db

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/utils/type-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ export function mergeTypes(first: TSType, second: TSType): TSType {
203203
}
204204

205205
function mergeTypeLiteralsIfPossible(first: TSTypeLiteral, second: TSTypeLiteral): TSTypeLiteral | null {
206+
if (first.members.length === 0) {
207+
return second;
208+
}
209+
if (second.members.length === 0) {
210+
return first;
211+
}
206212
const result = tsTypeLiteral([]);
207213
const firstProperties = getTypeProperties(first);
208214
if (Object.keys(firstProperties).length !== first.members.length) {

0 commit comments

Comments
 (0)