-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use isObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libs. And other minor refactorings
#8851
Conversation
Pull Request Test Coverage Report for Build d4447bdf-1f5d-4944-ba9e-8984ae03e7c3
💛 - Coveralls |
Relying on `isObservable` type guard from RxJS is better as it has less false-positives.
on every type assertion for `Observable<any>` that is not needed anymore.
I didn't wrote missing tests for Also, I didn't really understand the following nest/packages/microservices/server/server-grpc.ts Lines 257 to 267 in 7825c02
because |
isObervable
from rxjs
instead of our own implementation, and drop few deprecated APIs from 3rd-party libsisObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libs and remove useless filtering operation
isObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libs and remove useless filtering operationisObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libs
Replacie old and deprecated APIs from `rxjs`, `body-parser` and NodeJS core (read this guide https://nodejs.org/en/docs/guides/buffer-constructor-deprecation). Do notice that the later only touches test files, thus doesn't affect production code.
Before this change, when supplying an observable to `Server#transformToObservable` method, the return type was wrongly inferred as `Observable<Observable<X>>` while the real return is `Observable<X>` This commits fix this return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Also, add another test for `isString` utility, to clarify that it must return `false` for strings made by `String` constructor.
isObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libsisObervable
from rxjs
instead of our own implementation. Drop few deprecated APIs from 3rd-party libs. And other minor refactorings
LGTM |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: closes #8595
As you can see here: https://cs.github.com/nestjs/nest?&q=isObservable there are few versions of
isObservable
on this codebase. Which are implemented as follow:I'm under assumption that all of them are supposed to return true when the input is an
Observable
object created byrxjs
lib.What is the new behavior?
Using
isObservable
type guard fromrxjs
instead (introduced inrxjs@6
)which is implemented as follows here:
thus, I believe this should fix the linked Issue.
I've fixed the return type of
Server#transformToObservable
as well:before
now
Also, I've used
eslint-plugin-deprecation
to detected and remove deprecated APIs ofrxjs
andbody-parser
and ones related withBuffer
(nodejs). The latter only touches.spec.ts
files.Does this PR introduce a breaking change?
Do notice that, basically:
obj
is observable whenisFunction(obj.subscribe)
obj
is observable whenisFunction(obj.subscribe) && isFunction(obj.lift)
I'm pretty sure this means that there are no breaking changes due to how
isObservable
is being used in this codebase but I could be wrong.