@@ -186,6 +186,31 @@ export interface ModelStatic<D extends {} = AnyData> extends EventEmitter {
186
186
[ key : number ] : ModelClone < D > | undefined
187
187
}
188
188
189
+ /**
190
+ * The BaseModel constructor calls mergeWithAccessors(this, newData).
191
+ * This utility function correctly copies data between both regular
192
+ * objects and Vue.observable instances. If you create a class where
193
+ * you need to do your own merging, you probably don't want
194
+ * mergeWithAccessors to run twice. In this case, you can use the
195
+ * `merge: false` BaseModel instance option to prevent the internal
196
+ * merge. You can then access the mergeWithAccessors method by calling
197
+ * this method like MyModel.merge(this, newData).
198
+ * @param dest destination object
199
+ * @param source source object
200
+ * @param blacklist keys to ignore when merging
201
+ * @example
202
+ * class Todo extends BaseModel {
203
+ * public constructor(data, options?) {
204
+ * options.merge = false // Prevent the internal merge
205
+ * super(data, options)
206
+ * // ... your custom constructor logic happens here.
207
+ * // Call the static merge method to do your own merging.
208
+ * Todo.merge(this, data)
209
+ * }
210
+ * }
211
+ */
212
+ merge ( dest : unknown , source : unknown , blacklist ?: string [ ] ) : void
213
+
189
214
/**
190
215
* Create new Model
191
216
* @param data partial model data
0 commit comments