Skip to content

Commit

Permalink
updated code to not be to strictly typed, webpack fixed their types
Browse files Browse the repository at this point in the history
  • Loading branch information
strootje committed Feb 11, 2021
1 parent f43ed05 commit c0749f5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/clean-webpack-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sync as delSync } from 'del';
import path from 'path';
import { AssetInfo, Compilation, Compiler, Stats } from 'webpack';
import { Compilation, Compiler, Stats } from 'webpack';

export interface Options {
/**
Expand Down Expand Up @@ -238,17 +238,19 @@ class CleanWebpackPlugin {
/**
* Fetch Webpack's output asset files
*/
const assets: AssetInfo[] =
const assets =
stats.toJson({
assets: true,
}).assets || [];

const relatedAssets = assets
.map((asset) => {
return ((asset.related &&
Array.isArray(asset.related) &&
asset.related) ||
[]) as AssetInfo[];
return (
(asset.related &&
Array.isArray(asset.related) &&
asset.related) ||
[]
);
})
.reduce((previousAssets, currentAssets) => {
return [...previousAssets, ...currentAssets];
Expand Down

0 comments on commit c0749f5

Please sign in to comment.