Skip to content

Commit f1a77c6

Browse files
author
harish-sethuraman
committed
docs(readme): change linktag type
1 parent e05201c commit f1a77c6

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ type insert = string | ((linkTag: any) => void);
151151

152152
Default: `document.head.appendChild(linkTag);`
153153

154+
Inserts the `link` tag at the given position for [non-initial (async)](https://webpack.js.org/concepts/under-the-hood/#chunks) CSS chunks
155+
154156
> ⚠️ Only for [non-initial (async)](https://webpack.js.org/concepts/under-the-hood/#chunks) chunks.
155157
156158
By default, the `mini-css-extract-plugin` appends styles (`<link>` elements) to `document.head` of the current `window`.
@@ -204,7 +206,7 @@ A new `<link>` element will be inserted before the element with id `some-element
204206
Type:
205207

206208
```ts
207-
type attributes = object;
209+
type attributes = Record<string, string>};
208210
```
209211

210212
Default: `{}`

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const {
4242
* @property {Required<Configuration>['output']['filename']} [filename]
4343
* @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
4444
* @property {boolean} [ignoreOrder]
45-
* @property {string | ((linkTag: any) => void)} [insert]
45+
* @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
4646
* @property {Record<string, string>} [attributes]
4747
* @property {string | false | 'text/css'} [linkType]
4848
* @property {boolean} [runtime]
@@ -54,7 +54,7 @@ const {
5454
* @property {Required<Configuration>['output']['filename']} filename
5555
* @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
5656
* @property {boolean} ignoreOrder
57-
* @property {string | ((linkTag: any) => void)} [insert]
57+
* @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
5858
* @property {Record<string, string>} [attributes]
5959
* @property {string | false | 'text/css'} [linkType]
6060
* @property {boolean} runtime
@@ -63,7 +63,7 @@ const {
6363

6464
/**
6565
* @typedef {Object} RuntimeOptions
66-
* @property {string | ((linkTag: any) => void) | undefined} insert
66+
* @property {string | ((linkTag: HTMLLinkElement) => void) | undefined} insert
6767
* @property {string | false | 'text/css'} linkType
6868
* @property {Record<string, string> | undefined} attributes
6969
*/

types/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type PluginOptions = {
107107
filename?: Required<Configuration>["output"]["filename"];
108108
chunkFilename?: Required<Configuration>["output"]["chunkFilename"];
109109
ignoreOrder?: boolean | undefined;
110-
insert?: string | ((linkTag: any) => void) | undefined;
110+
insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined;
111111
attributes?: Record<string, string> | undefined;
112112
linkType?: string | false | undefined;
113113
runtime?: boolean | undefined;
@@ -138,7 +138,7 @@ type PluginOptions = {
138138
* @property {Required<Configuration>['output']['filename']} [filename]
139139
* @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
140140
* @property {boolean} [ignoreOrder]
141-
* @property {string | ((linkTag: any) => void)} [insert]
141+
* @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
142142
* @property {Record<string, string>} [attributes]
143143
* @property {string | false | 'text/css'} [linkType]
144144
* @property {boolean} [runtime]
@@ -149,15 +149,15 @@ type PluginOptions = {
149149
* @property {Required<Configuration>['output']['filename']} filename
150150
* @property {Required<Configuration>['output']['chunkFilename']} [chunkFilename]
151151
* @property {boolean} ignoreOrder
152-
* @property {string | ((linkTag: any) => void)} [insert]
152+
* @property {string | ((linkTag: HTMLLinkElement) => void)} [insert]
153153
* @property {Record<string, string>} [attributes]
154154
* @property {string | false | 'text/css'} [linkType]
155155
* @property {boolean} runtime
156156
* @property {boolean} [experimentalUseImportModule]
157157
*/
158158
/**
159159
* @typedef {Object} RuntimeOptions
160-
* @property {string | ((linkTag: any) => void) | undefined} insert
160+
* @property {string | ((linkTag: HTMLLinkElement) => void) | undefined} insert
161161
* @property {string | false | 'text/css'} linkType
162162
* @property {Record<string, string> | undefined} attributes
163163
*/
@@ -190,14 +190,14 @@ type NormalizedPluginOptions = {
190190
filename: Required<Configuration>["output"]["filename"];
191191
chunkFilename?: Required<Configuration>["output"]["chunkFilename"];
192192
ignoreOrder: boolean;
193-
insert?: string | ((linkTag: any) => void) | undefined;
193+
insert?: string | ((linkTag: HTMLLinkElement) => void) | undefined;
194194
attributes?: Record<string, string> | undefined;
195195
linkType?: string | false | undefined;
196196
runtime: boolean;
197197
experimentalUseImportModule?: boolean | undefined;
198198
};
199199
type RuntimeOptions = {
200-
insert: string | ((linkTag: any) => void) | undefined;
200+
insert: string | ((linkTag: HTMLLinkElement) => void) | undefined;
201201
linkType: string | false | "text/css";
202202
attributes: Record<string, string> | undefined;
203203
};

0 commit comments

Comments
 (0)