Re: Double wildcard "re-exports"... off-limits forever?

2020-02-13 Thread Jordan Harband
Wouldn't the solution be, don't use `import * as`, but instead, explicitly import and re-export what you want? On Thu, Feb 13, 2020 at 8:02 PM Ben Wiley wrote: > Apologies if this has already been talked about at length at some point. I > was unable to find much in the way of relevant

Double wildcard "re-exports"... off-limits forever?

2020-02-13 Thread Ben Wiley
Apologies if this has already been talked about at length at some point. I was unable to find much in the way of relevant discussions. I found a compelling use case for something which seems to be off-limits in the JavaScript language, that is wildcard re-exporting where the same export name

Re: Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Andrea Giammarchi
Anyway, if anyone is interested, I've published the `assign-properties` module [1] [1] https://github.com/WebReflection/assign-properties#readme On Thu, Feb 13, 2020 at 7:51 PM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > The fact `assign` doesn't copy descriptors and has potential

Re: Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Andrea Giammarchi
The fact `assign` doesn't copy descriptors and has potential side-effects is documented extensively though, meaning there is room for improvement, or simply a missing native way to do that, like it was for `getOwnPropertyDescriptors`, that following your logic should've never landed. But I guess

Re: Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Jordan Harband
It seems like it’s the exact implementation you want, just for 1 object instead of N. Object.assign was added because versions of it were all over the web, used very frequently. How frequent is the pattern where people want to copy descriptors, such that it would deserve reification in the

Re: Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Andrea Giammarchi
That has nothing to do with this, right? ```js const {assign, defineProperties, getOwnPropertyDescriptors} = Object; const assignProperties = (base, ...mixins) => defineProperties( base, mixins.reduce( (descriptors, mixin) => assign( descriptors,

Re: Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Jordan Harband
`Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))`? On Thu, Feb 13, 2020 at 2:24 AM Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Both `Object.assign` and `{...extend}` suffer a tiny gotcha: properties > are never assigned, neither retrieved, as accessors,

Any chance for an `Object.assignProperties` ?

2020-02-13 Thread Andrea Giammarchi
Both `Object.assign` and `{...extend}` suffer a tiny gotcha: properties are never assigned, neither retrieved, as accessors, with side-effects too. Example: ```js const Counter = { _count: 0, get count() { return this._count++; } }; const incr1 = Object.assign({}, Counter); const incr2