Merge pull request #23578 from alan-agius4/patch-4

webpack: remove union types with type `any`
This commit is contained in:
Daniel Rosenwasser
2018-02-13 10:44:08 -08:00
committed by GitHub
27 changed files with 73 additions and 48 deletions
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Urthen/case-sensitive-paths-webpack-plugin#readme
// Definitions by: Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/johnagan/clean-webpack-plugin
// Definitions by: Jed Fox <https://github.com/j-f1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/webpack-contrib/compression-webpack-plugin
// Definitions by: Anton Kandybo <https://github.com/dublicator>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+2 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/kevlened/copy-webpack-plugin
// Definitions by: flying-sheep <https://github.com/flying-sheep>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack'
import { IOptions } from 'minimatch'
@@ -30,7 +31,7 @@ interface CopyPattern {
context?: string
/**
* Removes all directory references and only copies file names.
*
*
* If files have the same name, the result is non-deterministic. (default: `false`)
*/
flatten?: boolean
+3 -2
View File
@@ -2,12 +2,13 @@
// Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { Plugin } from 'webpack';
export = DuplicatePackageCheckerWebpackPlugin;
declare class DuplicatePackageCheckerWebpackPlugin extends webpack.Plugin {
declare class DuplicatePackageCheckerWebpackPlugin extends Plugin {
constructor(options?: DuplicatePackageCheckerWebpackPlugin.Options);
}
+4 -3
View File
@@ -2,8 +2,9 @@
// Project: https://github.com/webpack-contrib/extract-text-webpack-plugin
// Definitions by: flying-sheep <https://github.com/flying-sheep>, kayo <https://github.com/katyo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { Plugin, NewLoader, OldLoader } from 'webpack';
export = ExtractTextPlugin;
@@ -11,13 +12,13 @@ export = ExtractTextPlugin;
* extract-text-webpack-plugin has no support for .options instead of .query yet.
* See https://github.com/webpack/extract-text-webpack-plugin/issues/281
*/
type Loader = string | webpack.OldLoader | webpack.NewLoader;
type Loader = string | OldLoader | NewLoader;
/**
* Use an `ExtractTextPlugin` instance and a loader returned by `extract` in concert to write files to disk instead of loading them into others.
* Usage example at https://github.com/webpack/extract-text-webpack-plugin#usage-example-with-css
*/
declare class ExtractTextPlugin extends webpack.Plugin {
declare class ExtractTextPlugin extends Plugin {
/** Create a plugin instance defining the extraction target file(s) for the files loaded by `extract` */
constructor(options: string | ExtractTextPlugin.PluginOptions);
/**
+1
View File
@@ -4,6 +4,7 @@
// Benjamin Lim <https://github.com/bumbleblym>
// Tomek Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
import { Options as HtmlMinifierOptions } from 'html-minifier';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/jaketrent/html-webpack-template
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
+3 -1
View File
@@ -3,9 +3,11 @@
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
// Totooria Hyperion <https://github.com/TotooriaHyperion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
import { loader } from "webpack";
import { loader } from 'webpack';
export interface InterpolateOption {
context?: string;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/lodash/lodash-webpack-plugin#readme
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/NMFR/optimize-css-assets-webpack-plugin
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+2 -1
View File
@@ -2,8 +2,9 @@
// Project: https://github.com/JaKXz/stylelint-webpack-plugin
// Definitions by: Arne Bahlo <https://github.com/bahlo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from "webpack";
import { Plugin } from 'webpack';
export = StylelintWebpackPlugin;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/th0r/webpack-bundle-analyzer
// Definitions by: Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as webpack from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/mozilla-neutrino/webpack-chain
// Definitions by: Eirikur Nilsson <https://github.com/eirikurn>, Paul Sachs <https://github.com/psachs21>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as webpack from 'webpack';
import * as https from 'https';
+3 -2
View File
@@ -2,12 +2,13 @@
// Project: https://github.com/alexindigo/webpack-chunk-hash#readme
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { Plugin } from 'webpack';
export = WebpackChunkHash;
declare class WebpackChunkHash extends webpack.Plugin {
declare class WebpackChunkHash extends Plugin {
constructor(options?: WebpackChunkHash.Options);
}
+3 -3
View File
@@ -2,12 +2,12 @@
// Project: https://github.com/gpbl/webpack-cleanup-plugin#readme
// Definitions by: Luka Maljic <https://github.com/malj>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { Plugin } from 'webpack';
export = WebpackCleanupPlugin;
declare class WebpackCleanupPlugin extends webpack.Plugin {
declare class WebpackCleanupPlugin extends Plugin {
constructor(options?: WebpackCleanupPlugin.Options);
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/nwinch/webpack-dotenv-plugin#readme
// Definitions by: Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as webpack from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/TiddoLangerak/webpack-fail-plugin
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
///<reference types="webpack" />
+5 -5
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { Configuration } from 'webpack';
export = webpackMerge;
@@ -18,18 +18,18 @@ declare namespace webpackMerge {
customizeArray?: CustomizeArrayFunction | UniqueFunction;
customizeObject?: CustomizeObjectFunction;
}
type ConfigurationMergeFunction = (...configs: webpack.Configuration[]) => webpack.Configuration;
type ConfigurationMergeFunction = (...configs: Configuration[]) => Configuration;
type ConfigurationMergeConfigFunction = (customizeOptions: CustomizeOptions) => ConfigurationMergeFunction;
type MergeFunction = ConfigurationMergeFunction | ConfigurationMergeConfigFunction;
type MergeStrategy = 'prepend' | 'append' | 'replace';
interface WebpackMerge {
(...configs: webpack.Configuration[]): webpack.Configuration;
(...configs: Configuration[]): Configuration;
(customizeOptions: CustomizeOptions): ConfigurationMergeFunction;
unique: UniqueFunction;
smart: ConfigurationMergeFunction;
multiple: ConfigurationMergeFunction;
strategy(options: {[field: string]: MergeStrategy}): ConfigurationMergeFunction;
smartStrategy(options: {[key: string]: MergeStrategy}): ConfigurationMergeFunction;
strategy(options: { [field: string]: MergeStrategy }): ConfigurationMergeFunction;
smartStrategy(options: { [key: string]: MergeStrategy }): ConfigurationMergeFunction;
}
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/survivejs/webpack-merge
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
///<reference types="webpack" />
+3 -2
View File
@@ -2,12 +2,13 @@
// Project: https://github.com/liady/webpack-node-externals
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import webpack = require('webpack');
import { ExternalsFunctionElement } from 'webpack';
export = webpackNodeExternals;
declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement;
declare function webpackNodeExternals(options?: webpackNodeExternals.Options): ExternalsFunctionElement;
declare namespace webpackNodeExternals {
type WhitelistOption = string | RegExp;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Turbo87/webpack-notifier#readme
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'webpack';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/shama/webpack-stream
// Definitions by: Ian Clanton-Thuon <https://github.com/iclanton>, Benjamin Lim <https://github.com/bumbleblym>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/js-dxtools/webpack-validator
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
///<reference types="webpack" />
+19 -15
View File
@@ -10,6 +10,7 @@
// Alan Agius <https://github.com/alan-agius4>
// Spencer Elliott <https://github.com/elliottsj>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
@@ -76,7 +77,7 @@ declare namespace webpack {
/** Capture timing information for each module. */
profile?: boolean;
/** Cache generated modules and chunks to improve performance for multiple incremental builds. */
cache?: boolean | any;
cache?: boolean | object;
/** Enter watch mode, which rebuilds on file change. */
watch?: boolean;
watchOptions?: Options.WatchOptions;
@@ -491,7 +492,7 @@ declare namespace webpack {
*/
maxEntrypointSize?: number;
}
type Stats = webpack.Stats.ToStringOptions;
type Stats = Stats.ToStringOptions;
type WatchOptions = ICompiler.WatchOptions;
}
@@ -541,7 +542,7 @@ declare namespace webpack {
type Handler = ICompiler.Handler;
type WatchOptions = ICompiler.WatchOptions;
class Watching implements webpack.Watching {
class Watching implements Watching {
constructor(compiler: Compiler, watchOptions: Watching.WatchOptions, handler: Watching.Handler);
close(callback: () => void): void;
@@ -1029,7 +1030,7 @@ declare namespace webpack {
* If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders,
* continuing with the calls to the more left loaders. data can be passed between pitch and normal call.
*/
pitch?(remainingRequest: string, precedingRequest: string, data: any): any | undefined;
pitch?(remainingRequest: string, precedingRequest: string, data: any): any;
/**
* By default, the resource file is treated as utf-8 string and passed as String to the loader.
@@ -1259,37 +1260,40 @@ declare namespace webpack {
/** @deprecated */
namespace compiler {
/** @deprecated use webpack.Compiler */
// tslint:disable-next-line:no-unnecessary-qualifier
type Compiler = webpack.Compiler;
/** @deprecated use webpack.Compiler.Watching */
type Watching = webpack.Compiler.Watching;
type Watching = Compiler.Watching;
/** @deprecated use webpack.Compiler.WatchOptions */
type WatchOptions = webpack.Compiler.WatchOptions;
type WatchOptions = Compiler.WatchOptions;
/** @deprecated use webpack.Stats */
// tslint:disable-next-line:no-unnecessary-qualifier
type Stats = webpack.Stats;
/** @deprecated use webpack.Stats.ToJsonOptions */
type StatsOptions = webpack.Stats.ToJsonOptions;
type StatsOptions = Stats.ToJsonOptions;
/** @deprecated use webpack.Stats.ToStringOptions */
type StatsToStringOptions = webpack.Stats.ToStringOptions;
type StatsToStringOptions = Stats.ToStringOptions;
/** @deprecated use webpack.Compiler.Handler */
type CompilerCallback = webpack.Compiler.Handler;
type CompilerCallback = Compiler.Handler;
}
/** @deprecated use webpack.Options.Performance */
type PerformanceOptions = webpack.Options.Performance;
type PerformanceOptions = Options.Performance;
/** @deprecated use webpack.Options.WatchOptions */
type WatchOptions = webpack.Options.WatchOptions;
type WatchOptions = Options.WatchOptions;
/** @deprecated use webpack.EvalSourceMapDevToolPlugin.Options */
type EvalSourceMapDevToolPluginOptions = webpack.EvalSourceMapDevToolPlugin.Options;
type EvalSourceMapDevToolPluginOptions = EvalSourceMapDevToolPlugin.Options;
/** @deprecated use webpack.SourceMapDevToolPlugin.Options */
type SourceMapDevToolPluginOptions = webpack.SourceMapDevToolPlugin.Options;
type SourceMapDevToolPluginOptions = SourceMapDevToolPlugin.Options;
/** @deprecated use webpack.optimize.UglifyJsPlugin.CommentFilter */
type UglifyCommentFunction = webpack.optimize.UglifyJsPlugin.CommentFilter;
type UglifyCommentFunction = optimize.UglifyJsPlugin.CommentFilter;
/** @deprecated use webpack.optimize.UglifyJsPlugin.Options */
type UglifyPluginOptions = webpack.optimize.UglifyJsPlugin.Options;
type UglifyPluginOptions = optimize.UglifyJsPlugin.Options;
}
+1 -8
View File
@@ -1,10 +1,3 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-any-union": false,
"no-unnecessary-qualifier": false,
"no-void-expression": false,
"space-within-parens": false
}
"extends": "dtslint/dt.json"
}
+10 -5
View File
@@ -509,8 +509,10 @@ declare function successfullyCompiled(): void;
webpack({
// configuration
}, (err, stats) => {
if (err)
return handleFatalError(err);
if (err) {
handleFatalError(err);
return;
}
const jsonStats = stats.toJson();
const jsonStatsWithAllOptions = stats.toJson({
assets: true,
@@ -537,10 +539,13 @@ webpack({
excludeAssets: ["filter", "excluded"]
});
if (jsonStats.errors.length > 0)
return handleSoftErrors(jsonStats.errors);
if (jsonStats.warnings.length > 0)
if (jsonStats.errors.length > 0) {
handleSoftErrors(jsonStats.errors);
return;
}
if (jsonStats.warnings.length > 0) {
handleWarnings(jsonStats.warnings);
}
successfullyCompiled();
});