@@ -555,50 +555,50 @@ export class StructureNode extends BaseConstraint<Structure.Declaration> {
555555 }
556556 }
557557
558- if ( ! this . index && this . undeclared !== "reject" ) return true
559-
560- const keys : Key [ ] = Object . keys ( data )
561- keys . push ( ... Object . getOwnPropertySymbols ( data ) )
562-
563- for ( let i = 0 ; i < keys . length ; i ++ ) {
564- const k = keys [ i ]
565-
566- if ( this . index ) {
567- for ( const node of this . index ) {
568- if ( node . signature . traverseAllows ( k , ctx ) ) {
569- if ( traversalKind === "Allows" ) {
570- const result = traverseKey (
571- k ,
572- ( ) => node . value . traverseAllows ( data [ k as never ] , ctx ) ,
573- ctx
574- )
575- if ( ! result ) return false
576- } else {
577- traverseKey (
578- k ,
579- ( ) => node . value . traverseApply ( data [ k as never ] , ctx ) ,
580- ctx
581- )
582- if ( ctx . failFast && ctx . currentErrorCount > errorCount )
583- return false
558+ if ( this . index || this . undeclared === "reject" ) {
559+ const keys : Key [ ] = Object . keys ( data )
560+ keys . push ( ... Object . getOwnPropertySymbols ( data ) )
561+
562+ for ( let i = 0 ; i < keys . length ; i ++ ) {
563+ const k = keys [ i ]
564+
565+ if ( this . index ) {
566+ for ( const node of this . index ) {
567+ if ( node . signature . traverseAllows ( k , ctx ) ) {
568+ if ( traversalKind === "Allows" ) {
569+ const result = traverseKey (
570+ k ,
571+ ( ) => node . value . traverseAllows ( data [ k as never ] , ctx ) ,
572+ ctx
573+ )
574+ if ( ! result ) return false
575+ } else {
576+ traverseKey (
577+ k ,
578+ ( ) => node . value . traverseApply ( data [ k as never ] , ctx ) ,
579+ ctx
580+ )
581+ if ( ctx . failFast && ctx . currentErrorCount > errorCount )
582+ return false
583+ }
584584 }
585585 }
586586 }
587- }
588587
589- if ( this . undeclared === "reject" && ! this . declaresKey ( k ) ) {
590- if ( traversalKind === "Allows" ) return false
588+ if ( this . undeclared === "reject" && ! this . declaresKey ( k ) ) {
589+ if ( traversalKind === "Allows" ) return false
591590
592- ctx . errorFromNodeContext ( {
593- // TODO: this should have its own error code
594- code : "predicate" ,
595- expected : "removed" ,
596- actual : "" ,
597- relativePath : [ k ] ,
598- meta : this . meta
599- } )
591+ ctx . errorFromNodeContext ( {
592+ // TODO: this should have its own error code
593+ code : "predicate" ,
594+ expected : "removed" ,
595+ actual : "" ,
596+ relativePath : [ k ] ,
597+ meta : this . meta
598+ } )
600599
601- if ( ctx . failFast ) return false
600+ if ( ctx . failFast ) return false
601+ }
602602 }
603603 }
604604
0 commit comments