Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit f6b62aa

Browse files
authored
Fix returning a Record in merge() when Record is empty (#23)
1 parent b86aebd commit f6b62aa

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

__tests__/issues.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,9 @@ describe('Issue #1643', () => {
125125
});
126126
});
127127
});
128+
129+
describe('Issue #1785', () => {
130+
const emptyRecord = Record({})();
131+
132+
expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord);
133+
});

src/Record.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class Record {
7777
l.set(this._indices[k], v === this._defaultValues[k] ? undefined : v);
7878
});
7979
});
80+
return this;
8081
};
8182

8283
const RecordTypePrototype = (RecordType.prototype = Object.create(

0 commit comments

Comments
 (0)