|
8 | 8 |
|
9 | 9 | - [Design Goals](#design-goals) |
10 | 10 | - [Why would you want to use this:](#why-would-you-want-to-use-this) |
11 | | - * [First, let's try to write the flexible factory function without mergePartially](#first-lets-try-to-write-the-flexible-factory-function-without-mergepartially) |
12 | | - * [Now let's refactor using mergePartially](#now-lets-refactor-using-mergepartially) |
| 11 | + - [First, let's try to write the flexible factory function without mergePartially](#first-lets-try-to-write-the-flexible-factory-function-without-mergepartially) |
| 12 | + - [Now let's refactor using mergePartially](#now-lets-refactor-using-mergepartially) |
13 | 13 | - [Examples](#examples) |
14 | 14 | - [F.A.Q. / Troubleshooting](#faq--troubleshooting) |
15 | | - * [Why wouldn't I just use Object.assign or the spread operator?](#why-wouldnt-i-just-use-objectassign-or-the-spread-operator) |
16 | | - * [I see lots of TypeScript stuff. Can I use this in JavaScript too?](#i-see-lots-of-typescript-stuff-can-i-use-this-in-javascript-too) |
17 | | - * [What's the difference between .deep and .shallow?](#whats-the-difference-between-deep-and-shallow) |
18 | | - * [Why is `.shallow` even necessary?](#why-is-shallow-even-necessary) |
19 | | - * [Why is my return type some strange error string?](#why-is-my-return-type-some-strange-error-string) |
| 15 | + - [Why wouldn't I just use Object.assign or the spread operator?](#why-wouldnt-i-just-use-objectassign-or-the-spread-operator) |
| 16 | + - [I see lots of TypeScript stuff. Can I use this in JavaScript too?](#i-see-lots-of-typescript-stuff-can-i-use-this-in-javascript-too) |
| 17 | + - [What's the difference between .deep and .shallow?](#whats-the-difference-between-deep-and-shallow) |
| 18 | + - [Why is `.shallow` even necessary?](#why-is-shallow-even-necessary) |
| 19 | + - [Why is my return type some strange error string?](#why-is-my-return-type-some-strange-error-string) |
20 | 20 | - [Contributions](#contributions) |
21 | 21 |
|
22 | 22 | <!-- tocstop --> |
@@ -157,6 +157,10 @@ const shallowResult = mergePartially.shallow(seed, { |
157 | 157 |
|
158 | 158 | There are some data types that are "less-compatible" with the library and therefore require a workaround ([click here for the description](https://github.com/dgreene1/merge-partially/blob/master/whyShallowInstead.md)). It should be rare that you need to use `.shallow`, but you might prefer `.shallow` over `.deep` anyway for explicitness. |
159 | 159 |
|
| 160 | +### Why am I getting some error about `never`? |
| 161 | + |
| 162 | +If you're seeing a Typescript error similar to `"Type 'number' is not assignable to type 'never'"` then you it's likely a case where you need to inform the function what the type is for your `seed` parameter. See [this thread](https://github.com/dgreene1/merge-partially/issues/100#issuecomment-694866025) for a detailed answer and a fun description in how TypeScript works. |
| 163 | + |
160 | 164 | ### Why is my return type some strange error string? |
161 | 165 |
|
162 | 166 | In order to meet the design goals (see above), mergePartially proactively prevents certain data combinations. See this link for more information on the soluton: [https://github.com/dgreene1/merge-partially/blob/master/whyShallowInstead.md](https://github.com/dgreene1/merge-partially/blob/master/whyShallowInstead.md) |
|
0 commit comments