Visitar URL original
fix: add missing `printer.preprocess` definition (#15123) · prettier/prettier@2b9efd5 · GitHub
Skip to content

Commit 2b9efd5

Browse files
so1vefisker
andauthored
fix: add missing printer.preprocess definition (#15123)
* fix: allow preprocess to return a promise * fix: types * chore: format * chore: changelog * Update changelog_unreleased/api/15123.md Co-authored-by: fisker Cheung <lionkay@gmail.com> * apply changes * Update 15123.md * Update 15123.md * Simplify changelog --------- Co-authored-by: fisker Cheung <lionkay@gmail.com>
1 parent 9b9dbf6 commit 2b9efd5

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎changelog_unreleased/api/15123.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#### Add missing type definition for `printer.preprocess` (#15123 by @so1ve)
2+
3+
```diff
4+
export interface Printer<T = any> {
5+
// ...
6+
+ preprocess?:
7+
+ | ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
8+
+ | undefined;
9+
}
10+
```

‎src/index.d.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ export interface Printer<T = any> {
485485
| Doc
486486
| null)
487487
| undefined;
488+
preprocess?:
489+
| ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
490+
| undefined;
488491
insertPragma?: (text: string) => string;
489492
/**
490493
* @returns `null` if you want to remove this node

0 commit comments

Comments
 (0)