Skip to content

Commit a358435

Browse files
build(release): index.js & index.d.ts for 2.0.0
[skip ci]
1 parent aa6c39d commit a358435

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export declare class Base {
1717
static plugins: TestPlugin[];
1818
static plugin<S extends Constructor<any> & {
1919
plugins: any[];
20-
}, T extends TestPlugin | TestPlugin[]>(this: S, plugin: T): {
20+
}, T1 extends TestPlugin, T2 extends TestPlugin[]>(this: S, plugin1: T1, ...additionalPlugins: T2): {
2121
new (...args: any[]): {
2222
[x: string]: any;
2323
};
2424
plugins: any[];
25-
} & S & Constructor<ReturnTypeOf<T>>;
25+
} & S & Constructor<UnionToIntersection<ReturnTypeOf<T1> & ReturnTypeOf<T2>>>;
2626
static defaults<S extends Constructor<any>>(this: S, defaults: Options): {
2727
new (...args: any[]): {
2828
[x: string]: any;

index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ var __extends = (this && this.__extends) || (function () {
1212
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1313
};
1414
})();
15+
var __spreadArrays = (this && this.__spreadArrays) || function () {
16+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
17+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
18+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
19+
r[k] = a[j];
20+
return r;
21+
};
1522
exports.__esModule = true;
1623
var Base = /** @class */ (function () {
1724
function Base(options) {
@@ -25,17 +32,24 @@ var Base = /** @class */ (function () {
2532
Object.assign(_this, plugin(_this, options));
2633
});
2734
}
28-
Base.plugin = function (plugin) {
35+
Base.plugin = function (plugin1) {
36+
var additionalPlugins = [];
37+
for (var _i = 1; _i < arguments.length; _i++) {
38+
additionalPlugins[_i - 1] = arguments[_i];
39+
}
2940
var _a;
3041
var currentPlugins = this.plugins;
42+
var newPlugins = __spreadArrays([
43+
plugin1
44+
], additionalPlugins);
3145
var BaseWithPlugins = (_a = /** @class */ (function (_super) {
3246
__extends(class_1, _super);
3347
function class_1() {
3448
return _super !== null && _super.apply(this, arguments) || this;
3549
}
3650
return class_1;
3751
}(this)),
38-
_a.plugins = currentPlugins.concat(plugin),
52+
_a.plugins = currentPlugins.concat(newPlugins.filter(function (plugin) { return !currentPlugins.includes(plugin); })),
3953
_a);
4054
return BaseWithPlugins;
4155
};

0 commit comments

Comments
 (0)