Skip to content

Commit

Permalink
fix: types (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Jan 20, 2022
1 parent 5f3a64a commit 324aecb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,10 @@ Type:
```ts
type transform =
| {
transformer: (input: string, absoluteFilename: string) => string;
transformer: (input: string, absoluteFilename: string) => string | Buffer;
cache?: boolean | TransformerCacheObject | undefined;
}
| ((input: string, absoluteFilename: string) => string);
| ((input: string, absoluteFilename: string) => string | Buffer);
```

Default: `undefined`
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
* @callback TransformerFunction
* @param {Buffer} input
* @param {string} absoluteFilename
* @returns {string | Buffer}
*/

/**
Expand Down
6 changes: 5 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export = CopyPlugin;
* @callback TransformerFunction
* @param {Buffer} input
* @param {string} absoluteFilename
* @returns {string | Buffer}
*/
/**
* @typedef {{ keys: { [key: string]: any } } | { keys: ((defaultCacheKeys: { [key: string]: any }, absoluteFilename: string) => Promise<{ [key: string]: any }>) }} TransformerCacheObject
Expand Down Expand Up @@ -229,7 +230,10 @@ type ToFunction = (pathData: {
}) => string;
type To = string | ToFunction;
type ToType = "dir" | "file" | "template";
type TransformerFunction = (input: Buffer, absoluteFilename: string) => any;
type TransformerFunction = (
input: Buffer,
absoluteFilename: string
) => string | Buffer;
type TransformerCacheObject =
| {
keys: {
Expand Down

0 comments on commit 324aecb

Please # to comment.