Internalize zen-observable
types and drop @types/zen-observable
dependency
#152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another approach to solving apollographql/apollo-client#8688 entirely within the
zen-observable-ts
package, which does not involve first converting the codebase to TypeScript as #151 attempted (so far unsuccessfully) to do.As I wrote in apollographql/apollo-client#8688 (comment), I believe this is a problem
zen-observable-ts
can and should solve within itself, without@apollo/client
having to declare a dependency on@types/zen-observable
in order to use types fromzen-observable-ts
.Unfortunately, as long as
zen-observable-ts
uses types from@types/zen-observable
, it appears some (yarn v2-using) consumers ofzen-observable-ts
will be forced to install@types/zen-observable
as a direct dependency of their own. This includes the@apollo/client
package itself, which depends directly onzen-observable-ts
and uses/exposes theObservable
type it exports in many places.To solve this problem, this PR removes
@types/zen-observable
from the picture, and internalizes the.d.ts
files that it provided inmodule.d.ts
, without global declarations like theZenObservable
namespace orSymbol.observable
.Note that
zen-observable
itself is not a TypeScript project, so@types/zen-observable
is merely a description of its existing JavaScript API, rather than a generated artifact of thezen-observable
build process. In that sense, internalizing those types withinzen-observable-ts
seems safe and legitimate, since these types are just another description of whatzen-observable
provides.Note that @brainkim and I previously internalized the implementation of
zen-observable/esm.js
in PR #105, so now the types are following suit.