Comparing version
@@ -69,2 +69,8 @@ "use strict"; | ||
var _loop_1 = function (constructor) { | ||
// Get the static properties on the constructor. Note that we must use getOwnPropertyNames because static | ||
// static methods are not enumerable. As a consequence, prototype, length, and name (inherited from Function) | ||
// must be filtered out | ||
var propNames = Object | ||
.getOwnPropertyNames(constructor) | ||
.filter(function (prop) { return !['prototype', 'length', 'name'].includes(prop); }); | ||
var _loop_2 = function (prop) { | ||
@@ -80,3 +86,4 @@ if (!Mixed.hasOwnProperty(prop)) { | ||
}; | ||
for (var prop in constructor) { | ||
for (var _i = 0, propNames_1 = propNames; _i < propNames_1.length; _i++) { | ||
var prop = propNames_1[_i]; | ||
_loop_2(prop); | ||
@@ -83,0 +90,0 @@ } |
{ | ||
"name": "ts-mixer", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "A very small TypeScript library that provides tolerable Mixin functionality.", | ||
@@ -5,0 +5,0 @@ "main": "dist/mixins.js", |
@@ -21,3 +21,3 @@ # ts-mixer | ||
* Automatic inference of the mixed class type[¹](#caveats) | ||
* Proper handling of static properties | ||
* Proper handling of static properties [³](#caveats) | ||
@@ -29,3 +29,4 @@ #### Caveats | ||
[Dealing with Generics](#dealing-with-generics). | ||
2. Due to a bug in the TypeScript compiler, this package only appears to work on TypeScript 3.4.4 and beyond. With that said, it may still to simply use the package instead of compiling it yourself, which is where I ran into issues, but I did not test this extensively. | ||
2. Due to a bug in the TypeScript compiler, this package only appears to work on TypeScript 3.4.4 and beyond. With that said, it may still work to simply use the package instead of compiling it yourself, which is where I ran into issues, but I did not test this extensively. | ||
3. Due how ES6 handles static properties, you should not use `length` or `name` as names for your static properties. See [this commit](https://github.com/tannerntannern/ts-mixer/commit/4f80f788b45383a8560766d1672abd2877c70723) for the technical reason. | ||
@@ -32,0 +33,0 @@ ## Non-features |
19283
4.32%142
5.19%171
0.59%