File tree 3 files changed +12
-20
lines changed
3 files changed +12
-20
lines changed Original file line number Diff line number Diff line change 4
4
* Similar to Object.assign(), but it doesn't execute getters. This allows us to have
5
5
* lazy properties on an object and still be able to merge them together
6
6
*
7
- * @flow
8
7
*/
9
8
export default function assign ( target : Object , ...sources : Object [ ] ) {
10
9
sources . forEach ( source => {
11
- let descriptors = Object . keys ( source ) . reduce ( ( acc , key ) => {
12
- acc [ key ] = Object . getOwnPropertyDescriptor ( source , key ) ;
13
- return acc ;
14
- } , { } ) ;
10
+ let descriptors = Object . keys ( source ) . reduce (
11
+ ( acc , key ) => {
12
+ const propertyDescriptor = Object . getOwnPropertyDescriptor ( source , key ) ;
13
+ if ( propertyDescriptor !== undefined ) {
14
+ acc [ key ] = propertyDescriptor ;
15
+ }
16
+ return acc ;
17
+ } ,
18
+ { } as PropertyDescriptorMap ,
19
+ ) ;
15
20
// by default, Object.assign copies enumerable Symbols too
16
21
Object . getOwnPropertySymbols ( source ) . forEach ( sym => {
17
22
let descriptor = Object . getOwnPropertyDescriptor ( source , sym ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import type {
19
19
UserConfigT ,
20
20
DependencyConfigT ,
21
21
} from 'types' ;
22
+ // $FlowFixMe - converted to TS
22
23
import assign from '../assign' ;
23
24
// $FlowFixMe - converted to TS
24
25
import merge from '../merge' ;
@@ -46,7 +47,7 @@ function getDependencyConfig(
46
47
: platformConfig . dependencyConfig (
47
48
root ,
48
49
/* $FlowFixMe - can't figure out which platform's dependency
49
- config to choose */
50
+ config to choose */
50
51
config . dependency . platforms [ platform ] ,
51
52
) ;
52
53
return dependency ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments