File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -460,6 +460,11 @@ export type StrictAstNode =
460460 | YulPaths
461461 | YulPath ;
462462
463+ export type PrintableCollectionNode = Extract <
464+ StrictAstNode ,
465+ { items : StrictAstNode [ ] }
466+ > ;
467+
463468export type CollectionNode = Extract < StrictAstNode , { items : unknown [ ] } > ;
464469
465470export type BinaryOperation = Extract <
Original file line number Diff line number Diff line change @@ -5,20 +5,19 @@ import { locEnd } from '../slang-utils/loc.js';
55import type { AstPath , Doc , ParserOptions } from 'prettier' ;
66import type {
77 AstNode ,
8- CollectionNode ,
9- StrictAstNode
8+ PrintableCollectionNode
109} from '../slang-nodes/types.d.ts' ;
1110import type { PrintFunction } from '../types.d.ts' ;
1211
1312const { hardline } = doc . builders ;
1413
1514export function printPreservingEmptyLines (
16- path : AstPath < CollectionNode > ,
15+ path : AstPath < PrintableCollectionNode > ,
1716 print : PrintFunction ,
1817 options : ParserOptions < AstNode >
1918) : Doc {
2019 return path . map ( ( childPath ) => {
21- const node = childPath . node as StrictAstNode ;
20+ const { node } = childPath ;
2221
2322 return [
2423 // Only attempt to prepend an empty line if `node` is not the first item
You can’t perform that action at this time.
0 commit comments