Skip to content

Commit 115bd8a

Browse files
peterblazejewiczjantimon
authored andcommitted
docs: Type definition minor updates
- defaults added for TS consumption - static `version` exposed - static `createHtmlTagObject` exposed - minor typos fixed Thanks!
1 parent 683435d commit 115bd8a

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

lib/html-tags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function htmlTagObjectToString (tagDefinition, xhtml) {
4747
* Static helper to create a tag object to be get injected into the dom
4848
*
4949
* @param {string} tagName
50-
* the name of the tage e.g. 'div'
50+
* the name of the tag e.g. 'div'
5151
*
5252
* @param {{[attributeName: string]: string|boolean}} [attributes]
5353
* tag attributes e.g. `{ 'class': 'example', disabled: true }`

typings.d.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ declare class HtmlWebpackPlugin {
1010
apply(compiler: Compiler): void;
1111

1212
static getHooks(compilation: compilation.Compilation): HtmlWebpackPlugin.Hooks;
13+
14+
/**
15+
* Static helper to create a tag object to be get injected into the dom
16+
*/
17+
static createHtmlTagObject(
18+
tagName: string,
19+
attributes?: { [attributeName: string]: string | boolean },
20+
innerHTML?: string
21+
): HtmlTagObject;
22+
23+
static readonly version: number;
1324
}
1425

1526
declare namespace HtmlWebpackPlugin {
@@ -23,7 +34,7 @@ declare namespace HtmlWebpackPlugin {
2334
interface ProcessedOptions {
2435
/**
2536
* Emit the file only if it was changed.
26-
* Default: `true`.
37+
* @default true
2738
*/
2839
cache: boolean;
2940
/**
@@ -32,14 +43,14 @@ declare namespace HtmlWebpackPlugin {
3243
chunks: "all" | string[];
3344
/**
3445
* Allows to control how chunks should be sorted before they are included to the html.
35-
* Default: `'auto'`.
46+
* @default 'auto'
3647
*/
3748
chunksSortMode:
3849
| "auto"
3950
| "manual"
4051
| (((entryNameA: string, entryNameB: string) => number));
4152
/**
42-
* List all entries which should not be injeccted
53+
* List all entries which should not be injected
4354
*/
4455
excludeChunks: string[];
4556
/**
@@ -48,8 +59,8 @@ declare namespace HtmlWebpackPlugin {
4859
favicon: false | string;
4960
/**
5061
* The file to write the HTML to.
51-
* Defaults to `index.html`.
5262
* Supports subdirectories eg: `assets/admin.html`
63+
* @default 'index.html'
5364
*/
5465
filename: string;
5566
/**
@@ -70,7 +81,7 @@ declare namespace HtmlWebpackPlugin {
7081
* blocking will result in <script src="..."></script>
7182
* defer will result in <script defer src="..."></script>
7283
*
73-
* The default behaviour is blocking
84+
* @default 'blocking'
7485
*/
7586
scriptLoading:
7687
| "blocking"
@@ -87,11 +98,11 @@ declare namespace HtmlWebpackPlugin {
8798
| { [attributeName: string]: string | boolean }; // custom properties e.g. { name:"viewport" content:"width=500, initial-scale=1" }
8899
};
89100
/**
90-
* HTML Minification options accepts the following valeus:
101+
* HTML Minification options accepts the following values:
91102
* - Set to `false` to disable minifcation
92103
* - Set to `'auto'` to enable minifcation only for production mode
93104
* - Set to custom minification according to
94-
* @https://github.com/kangax/html-minifier#options-quick-reference
105+
* {@link https://github.com/kangax/html-minifier#options-quick-reference}
95106
*/
96107
minify: 'auto' | boolean | MinifyOptions;
97108
/**

0 commit comments

Comments
 (0)