Skip to content

Commit fd8006d

Browse files
committed
Improve types for stringify
We shouldn't re-use PostCSS's type because it expects PostCSS statement nodes rather than value nodes.
1 parent 6b891ea commit fd8006d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/index.d.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface NodeBase {
2828
// Inherited from postcss.ContainerBase with no changes.
2929
source?: postcss.NodeSource;
3030
raws: postcss.NodeRaws;
31-
toString(stringifier?: postcss.Stringifier | postcss.Syntax): string;
31+
toString(stringifier?: Stringifier | Syntax): string;
3232
error(
3333
message: string,
3434
options?: postcss.NodeErrorOptions
@@ -210,6 +210,18 @@ export interface VariablesOptions {
210210
prefixes: string[];
211211
}
212212

213-
export const stringify: postcss.Stringifier;
213+
interface Syntax {
214+
stringify?: Stringifier;
215+
}
216+
217+
interface Builder {
218+
(part: string, node?: Node, type?: "start" | "end"): void;
219+
}
220+
221+
export interface Stringifier {
222+
(node: Node, builder: Builder): void;
223+
}
224+
225+
export const stringify: Stringifier;
214226

215227
export function nodeToString(node: Node): string;

0 commit comments

Comments
 (0)