Skip to content

Commit 324aecb

Browse files
authoredJan 20, 2022
fix: types (#661)
1 parent 5f3a64a commit 324aecb

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@ Type:
549549
```ts
550550
type transform =
551551
| {
552-
transformer: (input: string, absoluteFilename: string) => string;
552+
transformer: (input: string, absoluteFilename: string) => string | Buffer;
553553
cache?: boolean | TransformerCacheObject | undefined;
554554
}
555-
| ((input: string, absoluteFilename: string) => string);
555+
| ((input: string, absoluteFilename: string) => string | Buffer);
556556
```
557557

558558
Default: `undefined`

‎src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
7474
* @callback TransformerFunction
7575
* @param {Buffer} input
7676
* @param {string} absoluteFilename
77+
* @returns {string | Buffer}
7778
*/
7879

7980
/**

‎types/index.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export = CopyPlugin;
4949
* @callback TransformerFunction
5050
* @param {Buffer} input
5151
* @param {string} absoluteFilename
52+
* @returns {string | Buffer}
5253
*/
5354
/**
5455
* @typedef {{ keys: { [key: string]: any } } | { keys: ((defaultCacheKeys: { [key: string]: any }, absoluteFilename: string) => Promise<{ [key: string]: any }>) }} TransformerCacheObject
@@ -229,7 +230,10 @@ type ToFunction = (pathData: {
229230
}) => string;
230231
type To = string | ToFunction;
231232
type ToType = "dir" | "file" | "template";
232-
type TransformerFunction = (input: Buffer, absoluteFilename: string) => any;
233+
type TransformerFunction = (
234+
input: Buffer,
235+
absoluteFilename: string
236+
) => string | Buffer;
233237
type TransformerCacheObject =
234238
| {
235239
keys: {

0 commit comments

Comments
 (0)
Please sign in to comment.