Skip to content

Commit

Permalink
fix: types (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jan 31, 2022
1 parent 9a5a4c4 commit a1c2308
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -906,13 +906,13 @@ Type:

```ts
type info =
| Record<string, string>
| Record<string, any>
| ((item: {
absoluteFilename: string;
sourceFilename: string;
filename: string;
toType: ToType;
}) => Record<string, string>);
}) => Record<string, any>);
```

Default: `undefined`
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Expand Up @@ -37,7 +37,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
* @property {string} filename
* @property {Asset["source"]} source
* @property {Force | undefined} force
* @property {{ [key: string]: any }} info
* @property {Record<string, any>} info
*/

/**
Expand Down Expand Up @@ -104,7 +104,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
*/

/**
* @typedef { { [key: string]: string } | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => { [key: string]: string }) } Info
* @typedef { Record<string, any> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, any>) } Info
*/

/**
Expand Down
16 changes: 5 additions & 11 deletions types/index.d.ts
Expand Up @@ -20,7 +20,7 @@ export = CopyPlugin;
* @property {string} filename
* @property {Asset["source"]} source
* @property {Force | undefined} force
* @property {{ [key: string]: any }} info
* @property {Record<string, any>} info
*/
/**
* @typedef {string} StringPattern
Expand Down Expand Up @@ -73,7 +73,7 @@ export = CopyPlugin;
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
*/
/**
* @typedef { { [key: string]: string } | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => { [key: string]: string }) } Info
* @typedef { Record<string, any> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, any>) } Info
*/
/**
* @typedef {Object} ObjectPattern
Expand Down Expand Up @@ -216,9 +216,7 @@ type CopiedResult = {
filename: string;
source: Asset["source"];
force: Force | undefined;
info: {
[key: string]: any;
};
info: Record<string, any>;
};
type StringPattern = string;
type NoErrorOnMissing = boolean;
Expand Down Expand Up @@ -264,17 +262,13 @@ type TransformAllFunction = (
}[]
) => string | Buffer | Promise<string> | Promise<Buffer>;
type Info =
| {
[key: string]: string;
}
| Record<string, any>
| ((item: {
absoluteFilename: string;
sourceFilename: string;
filename: string;
toType: ToType;
}) => {
[key: string]: string;
});
}) => Record<string, any>);
type ObjectPattern = {
from: From;
globOptions?: import("globby").Options | undefined;
Expand Down

0 comments on commit a1c2308

Please sign in to comment.