Skip to content

Commit a1c2308

Browse files
authoredJan 31, 2022
fix: types (#666)
1 parent 9a5a4c4 commit a1c2308

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -906,13 +906,13 @@ Type:
906906

907907
```ts
908908
type info =
909-
| Record<string, string>
909+
| Record<string, any>
910910
| ((item: {
911911
absoluteFilename: string;
912912
sourceFilename: string;
913913
filename: string;
914914
toType: ToType;
915-
}) => Record<string, string>);
915+
}) => Record<string, any>);
916916
```
917917

918918
Default: `undefined`

‎src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
3737
* @property {string} filename
3838
* @property {Asset["source"]} source
3939
* @property {Force | undefined} force
40-
* @property {{ [key: string]: any }} info
40+
* @property {Record<string, any>} info
4141
*/
4242

4343
/**
@@ -104,7 +104,7 @@ const template = /\[\\*([\w:]+)\\*\]/i;
104104
*/
105105

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

110110
/**

‎types/index.d.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export = CopyPlugin;
2020
* @property {string} filename
2121
* @property {Asset["source"]} source
2222
* @property {Force | undefined} force
23-
* @property {{ [key: string]: any }} info
23+
* @property {Record<string, any>} info
2424
*/
2525
/**
2626
* @typedef {string} StringPattern
@@ -73,7 +73,7 @@ export = CopyPlugin;
7373
* @returns {string | Buffer | Promise<string> | Promise<Buffer>}
7474
*/
7575
/**
76-
* @typedef { { [key: string]: string } | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => { [key: string]: string }) } Info
76+
* @typedef { Record<string, any> | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record<string, any>) } Info
7777
*/
7878
/**
7979
* @typedef {Object} ObjectPattern
@@ -216,9 +216,7 @@ type CopiedResult = {
216216
filename: string;
217217
source: Asset["source"];
218218
force: Force | undefined;
219-
info: {
220-
[key: string]: any;
221-
};
219+
info: Record<string, any>;
222220
};
223221
type StringPattern = string;
224222
type NoErrorOnMissing = boolean;
@@ -264,17 +262,13 @@ type TransformAllFunction = (
264262
}[]
265263
) => string | Buffer | Promise<string> | Promise<Buffer>;
266264
type Info =
267-
| {
268-
[key: string]: string;
269-
}
265+
| Record<string, any>
270266
| ((item: {
271267
absoluteFilename: string;
272268
sourceFilename: string;
273269
filename: string;
274270
toType: ToType;
275-
}) => {
276-
[key: string]: string;
277-
});
271+
}) => Record<string, any>);
278272
type ObjectPattern = {
279273
from: From;
280274
globOptions?: import("globby").Options | undefined;

0 commit comments

Comments
 (0)
Please sign in to comment.