File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed
app-config-extensions/src Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,6 @@ describe('$if directive', () => {
121
121
} ) ;
122
122
123
123
it ( 'doesnt evaluate the else branch' , async ( ) => {
124
- const failDirective = forKey ( '$fail' , ( ) => ( ) => {
125
- throw new Error ( ) ;
126
- } ) ;
127
-
128
124
const source = new LiteralSource ( {
129
125
$if : {
130
126
$check : true ,
@@ -139,10 +135,6 @@ describe('$if directive', () => {
139
135
} ) ;
140
136
141
137
it ( 'doesnt evaluate the other branch' , async ( ) => {
142
- const failDirective = forKey ( '$fail' , ( ) => ( ) => {
143
- throw new Error ( ) ;
144
- } ) ;
145
-
146
138
const source = new LiteralSource ( {
147
139
$if : {
148
140
$check : false ,
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ export function tryDirective(): ParsingExtension {
52
52
. addProperty ( '$fallback' , SchemaBuilder . fromJsonSchema ( { } ) )
53
53
. addBoolean ( '$unsafe' , { } , false ) ,
54
54
( value ) => async ( parse ) => {
55
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
55
56
const { $value, $fallback, $unsafe } = value ;
56
57
57
58
try {
@@ -80,14 +81,14 @@ export function ifDirective(): ParsingExtension {
80
81
. addProperty ( '$then' , SchemaBuilder . fromJsonSchema ( { } ) )
81
82
. addProperty ( '$else' , SchemaBuilder . fromJsonSchema ( { } ) ) ,
82
83
( value ) => async ( parse ) => {
84
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
83
85
const { $check, $then, $else } = value ;
84
86
const condition = ( await parse ( $check ) ) . toJSON ( ) ;
85
87
86
88
if ( condition ) {
87
89
return parse ( $then , { shouldFlatten : true } ) ;
88
- } else {
89
- return parse ( $else , { shouldFlatten : true } ) ;
90
90
}
91
+ return parse ( $else , { shouldFlatten : true } ) ;
91
92
} ,
92
93
{ lazy : true } ,
93
94
) ,
You can’t perform that action at this time.
0 commit comments