@@ -115,7 +115,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
115115 segments . push ( `
116116 // instantiate fallback for ${ key } of type ${ safeTypeName ( type ) }
117117 this${ propertyAccess ( key ) } = ${ this . alias ( `model.properties["${ key } "]` ) } .instantiate(
118- snapshot?.[" ${ key } "] ,
118+ snapshot?${ propertyAccess ( key ) } ,
119119 context,
120120 this
121121 );
@@ -262,7 +262,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
262262 }
263263 }
264264
265- private expressionForDirectlyAssignableType ( key : string , type : DirectlyAssignableType , valueExpression = `snapshot?.[" ${ key } "] ` ) {
265+ private expressionForDirectlyAssignableType ( key : string , type : DirectlyAssignableType , valueExpression = `snapshot?${ propertyAccess ( key ) } ` ) {
266266 return type instanceof DateType ? `new Date(${ valueExpression } )` : valueExpression ;
267267 }
268268
@@ -290,7 +290,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
290290
291291 return `
292292 // setup reference for ${ key }
293- const ${ identifierVarName } = snapshot?.[" ${ key } "] ;
293+ const ${ identifierVarName } = snapshot?${ propertyAccess ( key ) } ;
294294
295295 // eager resolve path: check the reference cache immediately for the identifier
296296 const ${ instanceVarName } = context.referenceCache.get(${ identifierVarName } );
@@ -344,7 +344,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
344344
345345 return `
346346 // optional type for ${ key }
347- let ${ varName } = snapshot?.[" ${ key } "] ;
347+ let ${ varName } = snapshot?${ propertyAccess ( key ) } ;
348348 if (${ comparisonsToUndefinedValues . join ( " || " ) } ) {
349349 ${ varName } = ${ defaultValueExpression }
350350 }
@@ -357,7 +357,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
357357 return `
358358 // instantiate fallback for ${ key } of type ${ safeTypeName ( type ) }
359359 this${ propertyAccess ( key ) } = ${ this . alias ( `model.properties["${ key } "]` ) } .instantiate(
360- snapshot?.[" ${ key } "] ,
360+ snapshot?${ propertyAccess ( key ) } ,
361361 context,
362362 this
363363 );
@@ -367,7 +367,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
367367 // Directly assignable types are primitives so we don't need to worry about setting parent/env/etc. Hence, we just
368368 // pass the snapshot straight through to the constructor.
369369 return `
370- const arrayData = snapshot?.[" ${ key } "] ;
370+ const arrayData = snapshot?${ propertyAccess ( key ) } ;
371371 if (arrayData && arrayData.length > 0) {
372372 this${ propertyAccess ( key ) } = new QuickArray(
373373 ${ this . alias ( `model.properties["${ key } "]` ) } ,
@@ -396,7 +396,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
396396 return `
397397 const ${ mapVarName } = new QuickMap(${ this . alias ( `model.properties["${ key } "]` ) } , this, context);
398398 this${ propertyAccess ( key ) } = ${ mapVarName } ;
399- const ${ snapshotVarName } = snapshot?.[" ${ key } "] ;
399+ const ${ snapshotVarName } = snapshot?${ propertyAccess ( key ) } ;
400400 if (${ snapshotVarName } ) {
401401 for (const key in ${ snapshotVarName } ) {
402402 const item = ${ this . alias ( `model.properties["${ key } "].childrenType` ) } .instantiate(
@@ -422,7 +422,7 @@ export class InstantiatorBuilder<T extends IClassModelType<Record<string, IAnyTy
422422 destinationProp = this . alias ( `Symbol.for("${ this . getters . memoSymbolName ( snapshottedView . property ) } ")` ) ;
423423 }
424424
425- const valueExpression = `snapshot?.[" ${ snapshottedView . property } "] ` ;
425+ const valueExpression = `snapshot?${ propertyAccess ( snapshottedView . property ) } ` ;
426426 return `
427427 // setup snapshotted view for ${ snapshottedView . property }
428428 const ${ varName } = ${ valueExpression } ;
0 commit comments