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>
This commit is contained in:
Rayandfisker Cheung authored and GitHub committed 2023-07-22 01:45:15 +09:00
1 parent 9b9dbf6737
commit 2b9efd5bf1
2 files changed
+13

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
#### Add missing type definition for `printer.preprocess` (#15123 by @so1ve)
```diff
export interface Printer<T = any> {
// ...
+ preprocess?:
+ | ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
+ | undefined;
}
```
+3
View File
@@ -485,6 +485,9 @@ export interface Printer<T = any> {
| Doc
| null)
| undefined;
preprocess?:
| ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
| undefined;
insertPragma?: (text: string) => string;
/**
* @returns `null` if you want to remove this node