browserify: work around TypeScript issue 14107

Changes the overloaded function to a single function that accepts a union. This works around Microsoft/TypeScript#14107.
This commit is contained in:
Linus Unnebäck 2018-09-20 09:34:32 +02:00
parent da80a81f9b
commit e5d1a67ec6
No known key found for this signature in database
GPG Key ID: CE70CEAE9C0FA66F
2 changed files with 8 additions and 3 deletions

View File

@ -60,3 +60,6 @@ Object.keys(insertGlobals.vars).forEach((x) => {
var b = browserify('./browser/main.js', {
insertGlobalVars: insertGlobalVars
});
declare const file: string | string[];
b.add(file);

View File

@ -1,6 +1,9 @@
// Type definitions for Browserify 12.0
// Project: http://browserify.org/
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>, John Vilk <https://github.com/jvilk>, Leonard Thieu <https://github.com/leonard-thieu>
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>
// John Vilk <https://github.com/jvilk>
// Leonard Thieu <https://github.com/leonard-thieu>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@ -102,8 +105,7 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
* Add an entry file from file that will be executed when the bundle loads.
* If file is an array, each item in file will be added as an entry file.
*/
add(file: InputFile[], opts?: FileOptions): BrowserifyObject;
add(file: InputFile, opts?: FileOptions): BrowserifyObject;
add(file: InputFile | InputFile[], opts?: FileOptions): BrowserifyObject;
/**
* Make file available from outside the bundle with require(file).
* The file param is anything that can be resolved by require.resolve().