Skip to content

Commit 1063b04

Browse files
committed
test: Set typescript to strict mode (noImplicityAny:false)
1 parent b6dec4b commit 1063b04

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class HtmlWebpackPlugin {
3838
*/
3939
this.options = Object.assign({
4040
template: path.join(__dirname, 'default_index.ejs'),
41-
templateContent: undefined,
41+
templateContent: false,
4242
templateParameters: templateParametersGenerator,
4343
filename: 'index.html',
4444
hash: false,
@@ -155,7 +155,7 @@ class HtmlWebpackPlugin {
155155
.then(() => compilationPromise)
156156
.then(compiledTemplate => {
157157
// Allow to use a custom function / string instead
158-
if (self.options.templateContent !== undefined) {
158+
if (self.options.templateContent !== false) {
159159
return self.options.templateContent;
160160
}
161161
// Once everything is compiled evaluate the html factory
@@ -402,7 +402,7 @@ class HtmlWebpackPlugin {
402402
publicPath: string,
403403
js: Array<{entryName: string, path: string}>,
404404
css: Array<{entryName: string, path: string}>,
405-
manifest: string,
405+
manifest?: string,
406406
favicon?: string
407407
}}
408408
*/
@@ -430,7 +430,7 @@ class HtmlWebpackPlugin {
430430
publicPath: string,
431431
js: Array<{entryName: string, path: string}>,
432432
css: Array<{entryName: string, path: string}>,
433-
manifest: string,
433+
manifest?: string,
434434
favicon?: string
435435
}}
436436
*/
@@ -448,7 +448,7 @@ class HtmlWebpackPlugin {
448448
};
449449

450450
// Append a hash for cache busting
451-
if (this.options.hash) {
451+
if (this.options.hash && assets.manifest) {
452452
assets.manifest = this.appendHash(assets.manifest, compilationHash);
453453
}
454454

lib/hooks.js

-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
3333
publicPath: string,
3434
js: Array<{entryName: string, path: string}>,
3535
css: Array<{entryName: string, path: string}>,
36-
manifest: string,
3736
},
3837
outputName: string,
3938
plugin: HtmlWebpackPlugin
@@ -45,7 +44,6 @@ const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
4544
publicPath: string,
4645
js: Array<{entryName: string, path: string}>,
4746
css: Array<{entryName: string, path: string}>,
48-
manifest: string,
4947
},
5048
outputName: string,
5149
plugin: HtmlWebpackPlugin,
@@ -57,7 +55,6 @@ const AsyncSeriesWaterfallHook = require('tapable').AsyncSeriesWaterfallHook;
5755
publicPath: string,
5856
js: Array<{entryName: string, path: string}>,
5957
css: Array<{entryName: string, path: string}>,
60-
manifest: string,
6158
},
6259
outputName: string,
6360
plugin: HtmlWebpackPlugin,

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"lib": ["es2017"],
88

99
/* Strict Type-Checking Options */
10-
"strict": false, /* Enable all strict type-checking options. */
11-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
10+
"strict": true, /* Enable all strict type-checking options. */
11+
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
1212
// "strictNullChecks": true, /* Enable strict null checks. */
1313
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
1414
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */

typings.d.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ interface HtmlWebpackPluginOptions {
88
*/
99
title: string,
1010
/**
11-
* `webpack` require path to the template.
11+
* The `webpack` require path to the template.
1212
* @see https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md
1313
*/
1414
template: string,
1515
/**
16-
*
16+
* Allow to use a html string instead of reading from a file
1717
*/
18-
templateContent: string | (() => string),
18+
templateContent:
19+
false // Use the template option instead to load a file
20+
| string
21+
| Promise<string>,
1922
/**
2023
* Allows to overwrite the parameters used in the template
2124
*/

0 commit comments

Comments
 (0)