Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion types/postcss-functions/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { PluginCreator } from "postcss";

export interface Options {
[key: string]: (...args: any[]) => any;
functions: {
[key: string]: (...args: any[]) => any;
};
}

declare const postcssFunctions: PluginCreator<Options>;
Expand Down
24 changes: 22 additions & 2 deletions types/postcss-functions/postcss-functions-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,39 @@ postcss([postcssFunctions]);
postcss([postcssFunctions()]);
postcss([
postcssFunctions({
functions: {
someFunction() {},
},
}),
]);
postcss([
postcssFunctions({
functions: {
someFunction(a: number) {
return "foo";
},
},
}),
]);
postcss([
postcssFunctions({
// @ts-expect-error Functions must be inside of `functions` object
someFunction() {},
}),
]);
postcss([
postcssFunctions({
// @ts-expect-error Functions must be inside of `functions` object
someFunction(a: number) {
return "foo";
},
}),
]);
postcss([
postcssFunctions({
// @ts-expect-error Not a function
foo: "bar",
functions: {
// @ts-expect-error Not a function
foo: "bar",
},
}),
]);