Coder Social home page Coder Social logo

rebeccastevens / deepmerge-ts Goto Github PK

View Code? Open in Web Editor NEW
209.0 209.0 9.0 3.82 MB

Deeply merge 2 or more objects respecting type information.

License: BSD 3-Clause "New" or "Revised" License

TypeScript 100.00%
deep-merge deepmerge merge ts-merge typescript-merge

deepmerge-ts's Introduction

Rebecca Stevens

About me

I'm a TypeScript developer that tends to writes functional (as opposed to imperative) code. Lately I tend to mostly work on developing libraries.

I'm a pretty quiet person and I don't really know what else to write here.

ISTP-T

Super Powers

  • Asperger's Syndrome - It wasn't my first choice of super powers but I'll take what I can get.

Donations

If you like what I'm doing an wish to support me, any donations would be much appreciated. 😄

Real money

ko-fi

Cryptocurrencies

Bitcoin

bitcoin address QR code
bc1qgr2xwvkpztsaq9kplud84r3dfz4g3e7d5c5lxm

Ethereum

ethereum address QR code
0x643769d1DD2Cb912656dAA27C1b97e5A81EF9fd2

Litecoin

litecoin address QR code
ltc1qxr7p6z4hrh87g9mjjk67chyduwrh2nfrpxksjv

Languages, Tools and Technologies

Typescript JavaScript ECMAScript 6 WebComponents Vue React Redux Pinia Node.js npm Yarn rollup.js Vite HTML5 CSS3 PostCSS PHP Sass Material UI MySQL PostgreSQL C# C++ Arduino Java ESLint Markdown Json Yaml Prettier Lighthouse webhint Jest Codecov Visual Studio Code Apache Handlebars Git Adobe Photoshop Adobe Illustrator

My Stats

deepmerge-ts's People

Contributors

dependabot[bot] avatar fatihaziz avatar rebeccastevens avatar renovate[bot] avatar risu729 avatar semantic-release-bot avatar zaccharles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deepmerge-ts's Issues

Source object is ignored if it has a type other than a regular "object"

Bug Report

I would expect the resulting merged object to retain its type, like the "merge" function does in the "lodash" library. This issue makes this package not as useful as lodash, and not a suitable replacement since any unit testing of objects will result in a type mismatch.

Expected behavior

Merge should be successful if the source object (first argument) has a type.

Actual behavior

Source object is ignored if it has a type other than a regular object.

Steps to reproduce

import { merge } from "lodash";
import { deepmerge } from "deepmerge-ts";

class Object1 {
  value1: string | undefined;
  value2: string | undefined;
}

let object = new Object1();
object.value1 = "val1";
console.log(object);

let mergedLodash1 = merge({ value1: "val1" }, { value2: "val2" });
console.log("mergedLodash1", mergedLodash1);
// mergedLodash1 {value1: "val1", value2: "val2"}

let mergedLodash2 = merge(object, { value2: "val2" });
console.log("mergedLodash2", mergedLodash2);
// Object1 {value1: "val1", value2: "val2", constructor: Object}

let mergedDeepmerge1 = deepmerge({ value1: "val1" }, { value2: "val2" });
console.log("mergedDeepmerge1", mergedDeepmerge1);
// {value1: "val1", value2: "val2"}

let mergedDeepmerge2 = deepmerge(object, { value2: "val2" });
console.log("mergedDeepmerge2", mergedDeepmerge2);
// {value2: "val2"}

Proposed changes

Discriminated union types

Bug Report

Merging objects typed as a discriminated union breaks type discrimination.

The type inferred from the merge of two or more objects typed as a discriminated union cannot be narrowed down by TypeScript.

Expected behavior

import { deepmerge } from "deepmerge-ts"

type FOO = { a: true; b: string } | { a: false; b: number }

declare const foo: FOO
declare const bar: FOO
const baz = deepmerge(foo, bar)

if (foo.a) {
    foo.b // string
}

if (baz.a) {
    baz.b // string
}

Actual behavior

import { deepmerge } from "deepmerge-ts"

type FOO = { a: true; b: string } | { a: false; b: number }

declare const foo: FOO
declare const bar: FOO
const baz = deepmerge(foo, bar)

if (foo.a) {
    foo.b // string
}

if (baz.a) {
    baz.b // string | number
}

Failing tsd test

type V = { a: true; b: string } | { a: false; b: number };
const n = { a: true, b: "n" };
const o = { a: false, b: "o" };

const test17 = deepmerge(n as V, o as V);
if (test17.a) {
  expectType<string>(test17.b);
}

Remove fields that do not exist in object y

Suggestion

How this can be done?

const x = {
  record: {
    prop1: "value1",
    prop2: "value2"
  }
};
const y = {
  record: {
    prop1: "changed"
  }
};

merge(x,y)

//return
{
 record: {
    prop1: "changed"
  }
}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(dev-deps): update dependency @types/node to v18.11.19
  • chore(dev-deps): update dependency cspell to v6.22.0
  • chore(dev-deps): update dependency eslint-plugin-jsdoc to v39.8.0
  • chore(dev-deps): update typescript-eslint monorepo to v5.51.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)

Pending Branch Automerge

These updates await pending status checks before automerging. Click on a checkbox to abort the branch automerge, and create a PR instead.

  • chore(dev-deps): update dependency ava to v5

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/check-dist-files.yml
  • dorny/paths-filter v2
  • actions/github-script v6
.github/workflows/ci.yml
  • fkirc/skip-duplicate-actions v5.3.0
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/setup-node v3
  • codecov/codecov-action v3
.github/workflows/done-label.yml
.github/workflows/labels.yml
  • actions/checkout v3
  • micnncim/action-label-syncer v1
.github/workflows/pr.yml
  • amannn/action-semantic-pull-request v5.0.2
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/stale.yml
  • actions/stale v7
npm
benchmark/package.json
  • @types/benchmark ^2.1.1
  • benchmark ^2.1.4
  • deepmerge ^4.2.2
  • lodash ^4.17.21
  • merge-anything ^5.0.0
  • object-accumulator ^0.0.5
  • ts-node 10.9.1
  • node >=12.4.0
package.json
  • @commitlint/cli 17.4.2
  • @commitlint/config-conventional 17.4.2
  • @cspell/dict-cryptocurrencies 3.0.1
  • @rebeccastevens/eslint-config 1.5.2
  • @rollup/plugin-json 6.0.0
  • @rollup/plugin-node-resolve 15.0.1
  • @rollup/plugin-typescript 11.0.0
  • @semantic-release/changelog 6.0.2
  • @semantic-release/commit-analyzer 9.0.2
  • @semantic-release/git 10.0.1
  • @semantic-release/github 8.0.7
  • @semantic-release/npm 9.0.2
  • @semantic-release/release-notes-generator 10.0.3
  • @types/lodash 4.14.191
  • @types/node 18.11.18
  • @types/rollup-plugin-auto-external 2.0.2
  • @typescript-eslint/eslint-plugin 5.50.0
  • @typescript-eslint/parser 5.50.0
  • ava 4.3.3
  • c8 7.12.0
  • codecov 3.8.3
  • commitizen 4.3.0
  • cspell 6.20.1
  • denoify 1.4.9
  • eslint 8.33.0
  • eslint-config-prettier 8.6.0
  • eslint-import-resolver-typescript 3.5.3
  • eslint-plugin-ava 14.0.0
  • eslint-plugin-eslint-comments 3.2.0
  • eslint-plugin-functional 5.0.4
  • eslint-plugin-import 2.27.5
  • eslint-plugin-jsdoc 39.7.5
  • eslint-plugin-markdown 3.0.0
  • eslint-plugin-node 11.1.0
  • eslint-plugin-optimize-regex 1.2.1
  • eslint-plugin-prettier 4.2.1
  • eslint-plugin-promise 6.1.1
  • eslint-plugin-sonarjs 0.18.0
  • eslint-plugin-unicorn 45.0.2
  • husky 8.0.3
  • if-env-defined 1.0.0
  • lint-staged 13.1.0
  • lodash 4.17.21
  • markdownlint-cli 0.33.0
  • marked 4.2.12
  • prettier 2.8.3
  • prettier-plugin-packagejson 2.4.2
  • rimraf 3.0.2
  • rollup 2.79.1
  • rollup-plugin-auto-external 2.0.0
  • rollup-plugin-copy 3.4.0
  • rollup-plugin-dts 4.2.3
  • semantic-release 20.1.0
  • source-map-support 0.5.21
  • ts-node 10.9.1
  • tsd 0.25.0
  • tslib 2.5.0
  • typescript 4.9.5
  • node >=12.4.0
  • yarn 3.4.1

  • Check this box to trigger a request for Renovate to run again on this repository

Add DeepmergeInto

Discussed in #49

Originally posted by NightProgramming February 15, 2022
Sometimes it's useful to not create a new merge result object, but to have an existing object, that is the target of the whole merging process. Right now, I think, I would have to do something like:

// We want to merge newestData into myDataObject:

const result = deepmerge(myDataObject, newestData);
Object.assign(myDataObject, result);

If there was a signature like deepmerge(target, ...sources) the performance might be better because no intermediate object (result) needs to be created. Also there would be less code required (no Object.assign). And if we don't want to merge into any existing object we could do const result = deepmerge({}, myDataObject, newestData));. Note: The return value is the same object we used as first argument. Without having it returned by deepmerge we would need a bit more code: const result = {}; deepmerge(result, myDataObject, newestData);

Remove usage of Array.at

Bug Report

Array.at isn't available in some browsers, like iOS 12.5

Proposed changes

Replace the two occurrences of
values.at(-1)with values[values.length-1]
to make this library work fine in those browsers.

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

version 5 causes runtime error with Safari 14

Bug Report

Updating deepmerge-ts from v4.3.0 to v5.1.0 in our NextJS app started consistently causing unhandled runtime errors in Safari 14 (but not in newer versions of Safari). Reverting to 4.3.0 resolved the issue.

Expected behavior

Many of our users are still on Safari 14, so it would be nice if newer versions of deepmerge-ts still supported Safari 14.

Actual behavior

On Safari 14, we're consistently seeing an unhandled runtime error, specifically TypeError: values.at is not a function. (In 'values.at(-1)', 'values.at' is undefined).

I've noticed that 'values.at(-1)' relates to changes made to src/defaults/into.ts and src/defaults/vanilla.ts

CleanShot 2023-11-07 at 16 01 17

Steps to reproduce

Run an app that uses deepmerge-ts v5 in Safari 14 (we've been doing our testing in Browserstack).

Proposed changes

Import from @/deepmerge DENOIFY: DEPENDENCY UNMET (BUILTIN)

Bug Report

This line is throwing in deno:

import type { DeepMergeMergeFunctionsDefaults } from "@/deepmerge DENOIFY: DEPENDENCY UNMET (BUILTIN)";

Expected behavior

Expect it to Just Work™ :-)

Actual behavior

error: Relative import path "@/deepmerge DENOIFY: DEPENDENCY UNMET (BUILTIN)" not prefixed with / or ./ or ../
    at https://deno.land/x/[email protected]/dist/deno/types/options.ts:1:54

Steps to reproduce

Import this into a deno project

Proposed changes

I guess the import is supposed to be ../deepmerge.ts but I suspect you're using a build process to build the deno version and so it seems like that needs to be fixed?

Fix coverage

Coverage reports are reporting zero since switching to c8.

Key based array merging

I think providing the possibility to merge based on key instead of order would be nice:

const x = [{id: 1, value: "a"}, {id: 2, value: "b"}];
const y = [{id: 2, value: "b updated"}, {id: 1, value: "a updated"}];

const mergeSettings = {key: "id"};
const merged = deepmergeCustom(mergeSettings)(x, y);

console.log(merged);
// [{id: 1, value: "a updated"}, {id: 2, value: "b updated"}]

Maybe also provide the option to provide paths:

const x = {arr: [{id: 1, value: "a"}, {id: 2, value: "b"}], otherProp: {otherArray: [{myKey: "myKey1"}]}};
const mergeSettings = {keys: ["arr.id", "otherProp.otherArray.myKey"]};

Can deepmerge-ts merge circular object?

Suggestion

adding a test like this

test(`can merge circular object`, t => {
  const x = {
    a: { b: { c: `value1`, e: `im x`} },
  } as any
  x.a.b.a = x.a 
  x.a.b.b = x.a 

  const y = {
    a: { b: { c: `value2`, d: `val2` } },
    b: { b: { c: `value2`, d: `im y` } },
  } as any
  y.b.b.b = y.b 
  y.b.b.c = y.b 

  const expected = {
    a: {
      b: {
        a: x.a,
        b: x.a,
        c: `value2`,
        d: `val2`,
        e: `im x`,
      },
    },
    b: {
      b: {
        b: y.b,
        c: y.b,
        d: `im y`,
      },
    },
  }

  const merged = deepmerge(x, y)

  t.deepEqual(merged, expected)
  t.true(merged.a.b.a === merged.a)
  t.true(merged.a.b.b === merged.a)
})

there is some reason I cant test it myself on my desktop.

deepmerge function not working with PartialDeep

Note: Amazing library with amazing visual explanation of how it works!

Bug Report

When calling deepmerge using two objects, one of type T and the other of type PartialDeep from module type-fest, the result returned is PartialDeep, which is clearly wrong.

However, if we use a deep clone from module rfdc on the objects first, before trying to merge, then the merge works correctly.

Example pseudocode:

this.defaultConfig = {
   one: {
      a: {
        name: 'test'
        location: 'city'
      }
    }
    two: {
      deep: {
        value: 'ok'
        another: 'cool'
      }
    }
}

this.override = {
    two: {
      deep: {
        value: 'ok'
      }
    }
}
import { PartialDeep } from "type-fest"

private override?: PartialDeep<T>

getDefaultConfig(): T {
  if (this.override == undefined) {
    return this.defaultConfig
  }

  const merged = deepmerge(this.defaultConfig, this.override)
  console.log(merged)
  return (merged as T)
}

Expected behavior

deepmerge returns override deep merged into defaultConfig

Actual behavior

deepmerge returns override

Workaround

Use rfdc to deep clone the objects first. This works and produces the correct behavior.

const clone = require('rfdc')()

getDefaultConfig(): T {
  if (this.override == undefined) {
    return this.defaultConfig
  }

  const clonedDefaults = clone(this.defaultConfig)
  const clonedOverride = clone(this.override)

  const merged = deepmerge(clonedDefaults, clonedOverride)
  console.log(merged)
  return (merged as T)
}

Add default generic to `DeepMergeMergeFunctionUtils`

Suggestion

Have DeepMergeBuiltInMetaData be the default generic for the MM generic in DeepMergeMergeFunctionUtils so that it doesn't need to be explicitly stated.

type Meta = {
  // ...
};

export const myMerge = deepmergeCustom<{}, Meta>({
  metaDataUpdater: (previousMeta, metaMeta): Meta => {
      // ...
  },
  mergeOthers(values, utils, meta): unknown {
    if (someCondition(meta)) {
      return doCustomMerge(values, utils);
    }

    return utils.actions.defaultMerge;
  },
});

function doCustomMerge(
  values: ReadonlyArray<unknown>,
  utils: DeepMergeMergeFunctionUtils<Meta, DeepMergeBuiltInMetaData> // <-- Shouldn't need to specify `DeepMergeBuiltInMetaData`
): unknown {
  // ...
}

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: packageRules[2]: packageRules cannot combine both matchUpdateTypes and rangeStrategy. Rule: {"matchManagers":["npm"],"matchDepTypes":["dependencies"],"matchUpdateTypes":["major"],"semanticCommitType":"build","rangeStrategy":"replace"}

Please support [Module: null prototype]

Does not work with imported modules.

For example:

// module-a.js file
export const age = 30;

// module-b.js file
export const name = 'alice';

// deep merge
const a = await import('./module-a.js'); // [Module: null prototype] { age: 30 }
const b = await import('./module-b.js'); // [Module: null prototype] { name: 'alice' }
const merged = deepmerge(a, b);

Actual merge result

{
  name: 'alice'
}

Expected merge result

{
  age: 30,
  name: 'alice'
}

Provide meta data to custom merge functions

Suggestion

When merging values, it is not uncommon that meta data is need to know how to merge the values. An example would be that values may want to be merged differently if they are under a certain key on a record.

By default, key meta data should be provided by this library.

Users should also have the ability to control/customize the meta data as the deepmerge function steps through.
An example of customizing the meta data would be to mark a flag at some point through the merge to customize how child elements are then merged. An other example would be to keep track of the full key path travelled by the function.

Expecting deepmerge-ts default to existing value, instead of overwriting with undefined,

Bug Report

Usually when i use deepmerge-ts it will ignore if first object value is populated with anything but undefined, and second object has undefined value, it will ignore it and leave the first object value as it.

example:

const default = {
  "somekey" : {
     "populated": "im populated"
  }
}
const b = {
  "somekey": {
    "populated": void 0,
  },
  "keyb": true
}

const deepmerge = deepmergeCustom({ mergeArrays: false });
const result = deepmerge(default,b)

I'm expecting the result will be:

{
  "somekey": {
    "populated": "im populated",
  },
  "keyb": true
}

but instead I got:

{
  "somekey": {
    "populated": undefined,
  },
  "keyb": true
}

here the sandbox code: https://stackblitz.com/edit/typescript-58wd1f?file=main.ts

Expected behavior

should work as expected, ignoring undefined value

Actual behavior

populated value got overwrite by undefined,

Steps to reproduce

here the sandbox code: https://stackblitz.com/edit/typescript-58wd1f?file=main.ts

Proposed changes

if its on purpose, I propose there is an option to make it work, like mergeSkipUndefined:true
then it will opted out all undefined values before merging.

Environtment

OS: Windows 11
NodeJS: 14.17.6
NPM: 6.5
deepmerge-ts: 4.0.3

@fastify/deepmerge

Hi @RebeccaStevens

I also reimplemented deepmerge at fastify/deepmerge. It is much faster than the original deepmerge. It lacks the support of merging Sets and Maps, but maybe you have some thoughts about the implementation or the typings. Maybe you also want to improve the performance of your implementation and modify your code depending on it.

Runtime environment info

Suggestion

Can you please give some info about the supported runtime environments? Is Node required? Can the library be used in a browser (if so, what ES version do browsers need to support)? Can polyfills be used in order to use this library on old browsers (e.g. IE11)? Which polyfills would be required (I see things like Object.getOwnPropertySymbols being used)?

🐛Deepmerge-ts now making typescript build hang / not responding

Bug Report

It's started since last week, when I try to compile my typescript,
tsc
something wrong happen, it never done. something is stuck.

I tried to reinstall all node_modules, clean NPM cache, lastly I uninstall my node and change to version 16.14.2
none of them works...

then today, I try to install all my dependencies one by one and see if the tsc running / atleast throwing error.
when it comes to remove deepmerge-ts. it works, my tsc throwing error module not found.

having dependency to deepmerge-ts:
image

after removing
image

I tried with all version deepmerge-ts@3, @2, and @1, none of them work...

deepmerge-ts is awesome library that I need for my project, I hope it can be solved.

Expected behavior

Won't affect to tsc compiler behavior

Actual behavior

It make tsc compiler stuck

Steps to reproduce

  1. npm i deepmerge-ts
  2. npm run build or tsc
  3. getting stuck

System Environtment

  • OS: Windows 11
  • NodeJS: 16.14.2, 14.17.6
  • Typescript: 4.4.2, 4.4.4, 4.6.3
  • npm: 6, 8.5

Files:

tsconfig.json:

{
	"compileOnSave": true,
	"compilerOptions": {
		"composite": true,
		"baseUrl": "./",
		"outDir": "./lib",
		"declaration": true,
		"declarationDir": "./@types",
		"declarationMap": true,
		"target": "ES6",
		"module": "CommonJS",
		"lib": [
			"ES6",
			"ES2018",
			"ESNext",
			"DOM"
		],
		"strict": true,
		"strictPropertyInitialization": false,
		"noImplicitAny": false,
		"noImplicitThis": false,
		"pretty": true,
		"sourceMap": true,
		"allowJs": true,
		"noEmit": false,
		"moduleResolution": "node",
		"allowSyntheticDefaultImports": true,
		"forceConsistentCasingInFileNames": true,
		"esModuleInterop": true,
		"experimentalDecorators": true,
		"emitDecoratorMetadata": true,
		"useUnknownInCatchVariables": false,
		"removeComments": true,
		"typeRoots": [
			"src/@types",
			"node_modules/@types"
		]
	},
	"include": [
		"src/**/*.ts"
	],
	"exclude": [
		"dist",
		"lib",
		"node_modules",
		"tests",
		"*deprecated*",
		"*ignore*"
	]
}

DeepMergeArraysDefaultHKT is incorrect when merging more than 2 readonly tuples

Bug Report

When more than 2 tuples are merged using the default merging strategy, the resulting type is incorrect.

Expected behavior

Is typed correctly

Actual behavior

Is typed incorrectly

Steps to reproduce

const a = {
  foo: [1, 2, 3],
} as const;

const b = {
  foo: ["a", "b", "c"],
} as const;

const c = {
  foo: ["d", "e", "f"],
} as const;

// $ExpectType { foo: [1, 2, 3, "a", "b", "c", "d", "e", "f"]; }
// $ActualType { foo: [1, 2, 3]; }
deepmerge(a, b, c);

Merge B to A keep structure of B and only mutate original A object

Suggestion

I have 2 objects and I want to mutate object "A" to get all changes from "B" and keep all unmodified original "A" fields. So result should be mutated object A but with changes from object B not a new object.
Is this possible with deeepmerge-ts?

const a = {
  record: {
    name: "John",
    color: "green",
    size: "medium",
    list: ['apple']
    age: 5
  }
};

const b = {
  record: {
    name: "John",
    color: "red"
    list: ['banana','potato']
  }
};

merge(a,{...b})

// return original object A with changes from B

{
 record: {
    name: "John", // original value from A
    color: "red", // changed value
    list: ['banana','potato'], // changed value
    age: 5  // original value 
  }
}

Version 4.2.0 import broken

Bug Report

When upgrading from 4.1.x to 4.2.0, same code do not compile anymore

error TS2307: Cannot find module 'deepmerge-ts' or its corresponding type declarations.

2 import { deepmerge } from "deepmerge-ts";

Expected behavior

Normal compilation

Safari on bigSur 11.0.1

Bug Report

Console error also with example in doc:

TypeError: values.at is not a function. (In 'values.at(-1)', 'values.at' is undefined)

Expected behavior

no console error :-)

Actual behavior

TypeError: values.at is not a function. (In 'values.at(-1)', 'values.at' is undefined)

Steps to reproduce

use it in safari:

const x = {
		record: {
		  prop1: "value1",
		  prop2: "value2",
		},
		array: [1, 2, 3],
		set: new Set([1, 2, 3]),
		map: new Map([
		  ["key1", "value1"],
		  ["key2", "value2"],
		]),
	  };

	  const y = {
		record: {
		  prop1: "changed",
		  prop3: "value3",
		},
		array: [2, 3, 4],
		set: new Set([2, 3, 4]),
		map: new Map([
		  ["key2", "changed"],
		  ["key3", "value3"],
		]),
	  };

	  const merged = deepmerge(x, y);

	  console.log(merged);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.