Skip to content

Commit 0865683

Browse files
authored
Merge pull request #243 from samchon/fix/factory-printer-parentheses
fix(factory): preserve printer operand precedence
2 parents 4c3889d + 06d30fe commit 0865683

10 files changed

Lines changed: 1384 additions & 91 deletions

packages/factory/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ factory.createKeywordTypeNode(SyntaxKind.StringKeyword); // string
6565
A **width-aware** printer implemented directly (not a wrapper over `ts.Printer`). Like Prettier, it keeps lists on one line when they fit within `printWidth` and breaks them — with trailing commas — when they don't.
6666

6767
```typescript
68-
const printer = new TsPrinter({
68+
const props: TsPrinter.IProps = {
6969
printWidth: 80, // default 80
7070
indent: " ", // default two spaces
7171
newLine: "\n", // default LineFeed
72-
});
72+
};
73+
const printer = new TsPrinter(props);
7374

7475
printer.print(node); // print one node (or a SourceFile)
7576
printer.printNodes([a, b, c]); // print many nodes, joined by new lines

0 commit comments

Comments
 (0)