Skip to content

Commit

Permalink
fix: 优化消息类型,允许未定义字段的存在 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpyer committed Dec 20, 2023
1 parent 922f088 commit 2fc3e5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Core/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Message

return new Proxy<Message>(this, {
set: function (obj, key, val) {
if (typeof key === 'symbol') key = key.toString();
if (typeof obj[key] !== 'undefined') {
obj[key] = val;
}
Expand All @@ -29,6 +30,7 @@ class Message
return true;
},
get: function (obj, key) {
if (typeof key === 'symbol') key = key.toString();
if (typeof obj[key] !== 'undefined') {
return obj[key];
}
Expand Down Expand Up @@ -85,7 +87,7 @@ class Message

};

interface Message extends HasAttributesMixin {
interface Message extends Recordable, HasAttributesMixin {
};

applyMixins(Message, [HasAttributesMixin]);
Expand Down

0 comments on commit 2fc3e5b

Please sign in to comment.