File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import type {UnknownMessage} from "./unknown-types";
19
19
import { binaryWriteOptions } from "./binary-writer" ;
20
20
import { binaryReadOptions } from "./binary-reader" ;
21
21
22
+ const baseDescriptors = Object . getOwnPropertyDescriptors ( Object . getPrototypeOf ( { } ) ) ;
23
+
22
24
/**
23
25
* This standard message type provides reflection-based
24
26
* operations to work with a message.
@@ -67,7 +69,7 @@ export class MessageType<T extends object> implements IMessageType<T> {
67
69
this . typeName = name ;
68
70
this . fields = fields . map ( normalizeFieldInfo ) ;
69
71
this . options = options ?? { } ;
70
- this . messagePrototype = Object . defineProperty ( { } , MESSAGE_TYPE , { value : this } ) ;
72
+ this . messagePrototype = Object . create ( null , { ... baseDescriptors , [ MESSAGE_TYPE ] : { value : this } } ) ;
71
73
this . refTypeCheck = new ReflectionTypeCheck ( this ) ;
72
74
this . refJsonReader = new ReflectionJsonReader ( this ) ;
73
75
this . refJsonWriter = new ReflectionJsonWriter ( this ) ;
You can’t perform that action at this time.
0 commit comments