@@ -16,9 +16,9 @@ const { group, indent } = doc.builders;
1616
1717export const binaryGroupRulesBuilder =
1818 ( shouldGroup : ( node : BinaryOperation ) => boolean ) =>
19- ( path : AstPath < BinaryOperation > ) =>
19+ ( path : AstPath < StrictAstNode > ) =>
2020 ( document : Doc ) : Doc => {
21- const parent = path . parent as StrictAstNode ;
21+ const parent = path . parent ! ;
2222 if ( ! isBinaryOperation ( parent ) ) return group ( document ) ;
2323 if ( shouldGroup ( parent ) ) return group ( document ) ;
2424 return document ;
@@ -32,20 +32,19 @@ const isStatementWithoutIndentedOperation = createKindCheckFunction([
3232
3333export const shouldNotIndent = (
3434 node : StrictAstNode ,
35- path : AstPath < BinaryOperation > ,
35+ path : AstPath < StrictAstNode > ,
3636 index : number
3737) : boolean =>
3838 isStatementWithoutIndentedOperation ( node ) ||
3939 ( node . kind === NonterminalKind . ExpressionStatement &&
40- ( path . getNode ( index + 1 ) as StrictAstNode ) . kind ===
41- NonterminalKind . ForStatement ) ;
40+ path . getNode ( index + 1 ) ! . kind === NonterminalKind . ForStatement ) ;
4241
4342export const binaryIndentRulesBuilder =
4443 ( shouldIndent : ( node : BinaryOperation ) => boolean ) =>
45- ( path : AstPath < BinaryOperation > ) =>
44+ ( path : AstPath < StrictAstNode > ) =>
4645 ( document : Doc ) : Doc => {
4746 for ( let i = 1 , node = path . node ; ; i ++ ) {
48- const parent = path . getNode ( i ) as StrictAstNode ;
47+ const parent = path . getNode ( i ) ! ;
4948 if ( shouldNotIndent ( parent , path , i ) ) break ;
5049 if ( ! isBinaryOperation ( parent ) ) return indent ( document ) ;
5150 if ( shouldIndent ( parent ) ) return indent ( document ) ;
@@ -59,7 +58,7 @@ export const printBinaryOperation = (
5958 shouldGroupAndIndent : ( node : StrictAstNode ) => boolean
6059) : ( (
6160 node : BinaryOperation ,
62- path : AstPath < BinaryOperation > ,
61+ path : AstPath < StrictAstNode > ,
6362 print : PrintFunction ,
6463 options : ParserOptions < AstNode >
6564) => Doc ) =>
0 commit comments