diff options
-rw-r--r-- | src/fields/Document.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fields/Document.ts b/src/fields/Document.ts index c30e8f4db..cd393d676 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -273,13 +273,13 @@ export class Document extends Field { } @action - SetData<T, U extends Field & { Data: T }>(key: Key, value: T, ctor: { new(): U }, replaceWrongType = true) { + SetData<T, U extends Field & { Data: T }>(key: Key, value: T, ctor: { new(data: T): U }, replaceWrongType = true) { let field = this.Get(key, true); if (field instanceof ctor) { field.Data = value; } else if (!field || replaceWrongType) { - let newField = new ctor(); - newField.Data = value; + let newField = new ctor(value); + // newField.Data = value; this.Set(key, newField); } } |