From a1c2308511a4cccb92a22cb395b6eb66dc1c776b Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Mon, 31 Jan 2022 12:57:03 +0300 Subject: [PATCH] fix: types (#666) --- README.md | 4 ++-- src/index.js | 4 ++-- types/index.d.ts | 16 +++++----------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8f3ed70..78c6e3b 100644 --- a/README.md +++ b/README.md @@ -906,13 +906,13 @@ Type: ```ts type info = - | Record + | Record | ((item: { absoluteFilename: string; sourceFilename: string; filename: string; toType: ToType; - }) => Record); + }) => Record); ``` Default: `undefined` diff --git a/src/index.js b/src/index.js index 54fa203..2d126d8 100644 --- a/src/index.js +++ b/src/index.js @@ -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} info */ /** @@ -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 | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record) } Info */ /** diff --git a/types/index.d.ts b/types/index.d.ts index 4d6a5d4..019fc53 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -20,7 +20,7 @@ export = CopyPlugin; * @property {string} filename * @property {Asset["source"]} source * @property {Force | undefined} force - * @property {{ [key: string]: any }} info + * @property {Record} info */ /** * @typedef {string} StringPattern @@ -73,7 +73,7 @@ export = CopyPlugin; * @returns {string | Buffer | Promise | Promise} */ /** - * @typedef { { [key: string]: string } | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => { [key: string]: string }) } Info + * @typedef { Record | ((item: { absoluteFilename: string, sourceFilename: string, filename: string, toType: ToType }) => Record) } Info */ /** * @typedef {Object} ObjectPattern @@ -216,9 +216,7 @@ type CopiedResult = { filename: string; source: Asset["source"]; force: Force | undefined; - info: { - [key: string]: any; - }; + info: Record; }; type StringPattern = string; type NoErrorOnMissing = boolean; @@ -264,17 +262,13 @@ type TransformAllFunction = ( }[] ) => string | Buffer | Promise | Promise; type Info = - | { - [key: string]: string; - } + | Record | ((item: { absoluteFilename: string; sourceFilename: string; filename: string; toType: ToType; - }) => { - [key: string]: string; - }); + }) => Record); type ObjectPattern = { from: From; globOptions?: import("globby").Options | undefined;