[WIP] Interface all the things... #1853
Closed
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.
Description:
Let me prefix this with I really wish we didn't have to do this, but looking at the referenced issues I don't see the root problem being solved by the TypeScript compiler anytime soon.
There are problems when using
rxjs
with tools likenpm link
that cause the compiler to fail to resolve types properly and create lots of compiler errors, as it sees two copies of the same class, and they are not compatible.The goal of this change is to do the following:
Observable
an interface.Subscription
,Subscriber
, etc).Observable
is still the sameObservable
to external consumers.Related issue (if exists):
microsoft/TypeScript#6496
microsoft/TypeScript#7755
#1744
Issues
Work Inprogress Todos
Obsevable
->ObservableImpl
IObservable
->Observable
ObservableStatic
interfaceSubscription
(anything that the consumer may want to expose publicly)cc @Blesh @robwormald @kwonoj @staltz
cc @mhegazy @ahejlsberg - maybe this can be fixed easily in the compiler? 🙏
As it stands
rxjs
(and any other library for that matter) cannot export anyclass
es without causing potential compiler issues down the line for others. Essentially we're being penalized because we're using TypeScript to develop the library.Are there other simpler fixes? Can the compiler emit an identifier in the
.d.ts
files that so that it knows "hey this is the same interface as the other one I have over here"?