Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*This change should have no user impact.* *I recommend reviewing this with whitespace changes disabled.* `MapeoProject`'s `kProjectReplicate` member will give type errors if called with a boolean. We aren't doing this today, but [we will in our upcoming server work][0]. This happened because TypeScript's `Parameters` utility type only takes the *last* signature of an overloaded function. To quote [the docs][1]: > When inferring from a type with multiple call signatures (such as the > type of an overloaded function), inferences are made from the last > signature (which, presumably, is the most permissive catch-all case). > It is not possible to perform overload resolution based on a list of > argument types. To fix this, we specify the types manually rather than pull them out of `Parameters`. Doing this fixes the potential type error. I also did a small amount of cleanup on the types in this function. (This change is primarily to fix an error in our upcoming server branch, but I think it's useful on its own.) [0]: https://github.com/digidem/comapeo-core/blob/9aaeb37910821a6779ec8eef88af995e94448ba3/src/mapeo-project.js#L140-L141 [1]: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html
- Loading branch information