Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mergeOverwriteArray not using its own defined TSDoc #20

Open
EvitanRelta opened this issue Dec 20, 2022 · 0 comments
Open

mergeOverwriteArray not using its own defined TSDoc #20

EvitanRelta opened this issue Dec 20, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@EvitanRelta
Copy link
Owner

Context

The mergeOverwriteArray function found in src > core > helpers > mergeOverwriteArray.ts is like lodash's _.merge but overwrites array values instead of merging them like _.merge.

var users = {
  'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
};

var ages = {
  'data': [{ 'age': 36 }, { 'age': 40 }]
};

_.merge(users, ages);
// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }

mergeOverwriteArray(users, ages);
// => { 'data': [{ 'age': 36 }, { 'age': 40 }] }

The problem

mergeOverwriteArray uses the same type as _.merge, and has its own TSDoc defined in the file mergeOverwriteArray.ts.

However, (at least in VSCode) the TSDoc of it when its used outside of the mergeOverwriteArray.ts file is that of _.merge instead of its own defined TSDoc:

image


Help wanted

Any ideas on how to make mergeOverwriteArray have to same generic typing as _.merge but without inheriting its TSDoc?

@EvitanRelta EvitanRelta added bug Something isn't working help wanted Extra attention is needed labels Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant