@@ -558,7 +558,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
558558 CoreSchemaRegistry . _set (
559559 data ,
560560 pathFragments ,
561- answers [ path ] as { } ,
561+ answers [ path ] ,
562562 null ,
563563 undefined ,
564564 true ,
@@ -567,51 +567,22 @@ export class CoreSchemaRegistry implements SchemaRegistry {
567567 }
568568
569569 private static _set (
570- // tslint:disable-next-line:no-any
570+ // tslint:disable-next-line: no-any
571571 data : any ,
572572 fragments : string [ ] ,
573- value : { } ,
574- // tslint:disable-next-line:no-any
575- parent : any | null = null ,
573+ value : unknown ,
574+ parent : Record < string , unknown > | null = null ,
576575 parentProperty ?: string ,
577576 force ?: boolean ,
578577 ) : void {
579- for ( let i = 0 ; i < fragments . length ; i ++ ) {
580- const f = fragments [ i ] ;
581-
582- if ( f [ 0 ] == 'i' ) {
583- if ( ! Array . isArray ( data ) ) {
584- return ;
585- }
586-
587- for ( let j = 0 ; j < data . length ; j ++ ) {
588- CoreSchemaRegistry . _set ( data [ j ] , fragments . slice ( i + 1 ) , value , data , '' + j ) ;
589- }
590-
591- return ;
592- }
593-
594- if ( f . startsWith ( 'key' ) ) {
595- if ( typeof data !== 'object' ) {
596- return ;
597- }
598-
599- for ( const property in data ) {
600- CoreSchemaRegistry . _set ( data [ property ] , fragments . slice ( i + 1 ) , value , data , property ) ;
601- }
602-
603- return ;
604- }
605-
606-
607- // We know we need an object because the fragment is a property key.
578+ for ( const fragment of fragments ) {
608579 if ( ! data && parent !== null && parentProperty ) {
609580 data = parent [ parentProperty ] = { } ;
610581 }
611- parent = data ;
612- parentProperty = f ;
613582
614- data = data [ f ] ;
583+ parent = data ;
584+ parentProperty = fragment ;
585+ data = data [ fragment ] ;
615586 }
616587
617588 if ( parent && parentProperty && ( force || parent [ parentProperty ] === undefined ) ) {
0 commit comments