(path, options, print)
| 145 | - `TSEmptyBodyFunctionExpression` (TypeScript) |
| 146 | */ |
| 147 | function printMethodValue(path, options, print) { |
| 148 | const { node } = path; |
| 149 | const parametersDoc = printFunctionParameters(path, options, print); |
| 150 | const returnTypeDoc = printReturnType(path, print); |
| 151 | const shouldBreakParameters = shouldBreakFunctionParameters(node); |
| 152 | const shouldGroupParameters = shouldGroupFunctionParameters( |
| 153 | node, |
| 154 | returnTypeDoc, |
| 155 | ); |
| 156 | const parts = [ |
| 157 | print("typeParameters"), |
| 158 | group([ |
| 159 | shouldBreakParameters |
| 160 | ? group(parametersDoc, { shouldBreak: true }) |
| 161 | : shouldGroupParameters |
| 162 | ? group(parametersDoc) |
| 163 | : parametersDoc, |
| 164 | returnTypeDoc, |
| 165 | ]), |
| 166 | ]; |
| 167 | |
| 168 | if (node.body) { |
| 169 | parts.push(" ", print("body")); |
| 170 | } else { |
| 171 | parts.push(printSemicolon(options)); |
| 172 | } |
| 173 | |
| 174 | return parts; |
| 175 | } |
| 176 | |
| 177 | function canPrintParamsWithoutParens(node) { |
| 178 | const parameters = getFunctionParameters(node); |
no test coverage detected
searching dependent graphs…