Skip to content

Commit

Permalink
[#683] Convert merge.js to typescript (#687)
Browse files Browse the repository at this point in the history
* chore: rename merge.js to merge.ts (#683)

* chore: add type to deepmerge(#683)

* chore: add FlowFixMe temporarily for files converted to TS (#683)

* chore: add underscore in arg for unused param
  • Loading branch information
Naturalclar authored and Esemesek committed Sep 10, 2019
1 parent b49fe00 commit ed6205b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/tools/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
DependencyConfigT,
} from 'types';
import assign from '../assign';
// $FlowFixMe - converted to TS
import merge from '../merge';
import resolveNodeModuleDir from './resolveNodeModuleDir';

Expand Down
15 changes: 0 additions & 15 deletions packages/cli/src/tools/merge.js

This file was deleted.

15 changes: 15 additions & 0 deletions packages/cli/src/tools/merge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import deepmerge from 'deepmerge';

/**
* `deepmerge` concatenates arrays by default instead of overwriting them.
* We define custom merging function for arrays to change that behaviour
*/
export default function merge(
x: Array<{[key: string]: any}>,
y: Array<{[key: string]: any}>,
) {
return deepmerge(x, y, {
arrayMerge: (_destinationArray: any[], sourceArray: any[]): any[] =>
sourceArray,
});
}

0 comments on commit ed6205b

Please sign in to comment.