Dependencies update: rxjs 7.3.0, TypeScript 4.4.2 #998
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.
Ritual little dependency update.
To note that @typescript-eslint is not yet synchronized to TypeScript 4.4.2 (it was apparently released today, so we may forgive them!) and give a warning announcing it may not be compatible. So we might want to wait until they update that.
Due to some RxJS and TypeScript changes, I had to update the code:
Thanks to RxJS resolving Interface for ConnectableObservableLike is not exposed ReactiveX/rxjs#6529 in their last version (PR: fix: Expose
Connectable
, return type ofconnectable
ReactiveX/rxjs#6531), we can now rely on theConnectable
type.Previously we haphazardly relied on importing the
ConnectableObservableLike
interface from deep inside RxJS's non-API-exposed code (a solution which was not even the most elegant one at the time)TypeScript got rid of the
MSMediaKeys
andMSMediaKeySession
types for some reasons - types we use in our compatibility code for EME APIs. Here I blatantly copied their definition in previous versions in our compat code.TypeScript now define catched errors as
unknown
(https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-rc/#use-unknown-catch-variables) which I thought we already did. In reality, we may have been less zealous in tests files, where arguably ugly assertions have now been added.Two calls to
castToObservable
now do not type-check, for reasons which seem invalid. Casting the inputedPromise<void> | Promise<SomeType>
(in both cases it is the same type) as aPromise<unknown>
- which I guess is always compatible - works.So I did just that. However relying on casting is in some cases a little unsafe, so I would have preferred not to.
Did not think too much about that one, but the issue seems to be linked with how TypeScript now resolves generics relatively to inputted union types. Maybe we could improve on
castToObservable
's typing?TypeScript 4.4 comes with this nice
exactOptionalPropertyTypes
flag (https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-rc/#exact-optional-property-types) which basically treats differently an optional type (a type to which?
is appended in an interface, for example) and a possiblyundefined
type. The former cannot be set to undefined, the second has to be set, even if it is to set it toundefined
.This is a nice feature that I always wanted to add because there are subtle though important differences between the two (for example,
Object.assign
will overwrite anundefined
field with the same name than a previously-defined one). But while activating it, I noticed that a lot of different parts of the code do not pass this check, amounting to 200 or so errors.This is big, but not too big, so I guess we may work on it in the future, but it will necessitate its own PR.