-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Type signature review progress for v7 beta #5066
Comments
There is an issue with the |
IMO, at some stage we should change signatures that involve errors to use
See #2646 However, this is likely to be an inconvenient breaking change. And it would be reasonable to argue that whilst the TypeScript typings for Related Twitter conversation. |
Yes, please have another look at it. The last comment on that issue says it all: You can just replace const s1 = new Subject<void>();
s1.next(); // OK
s1.next(undefined); // OK
const s2 = new Subject<number>();
s2.next(); // error The only problem is when someone does this: const sAny = new Subject(); // No type parameter so defaults to `any`
sAny.next(); // Error because `any` is not mapped to an optional parameter I don't know what people expect when they create a Subject without an explicit type. The default of export declare class Subject<T = void> { /* ... */ }
const sVoid = new Subject(); // Defaults to Subject<void>.
sVoid.next(); // Works fine If you like to have bugs in your code, then you can still create a subject of any with: const sAny = new Subject<any>; |
OMG, I received a DM question about interop observables and I was writing up some notes that I could turn into an article. The ergonomics of actually using the When #4532 is also taken into consideration, pretty much all aspects of this interop are 👎 |
@cartant I replied to you in #4532 (comment) :) |
I will work on the following items' N-args signature/deprecating/renaming this week:
I'll try to open a PR early just so it's visible and there is no overlapping work. |
idk, if i should add this here or create a new ticket: the consider the follow example:
even explicitly typing even worse is passing no argument edit: it gets even more worse: edit2: since this is a bug which should be addressed before ^7 i created a bug ticket: #6064 |
As a general guide - for all repos - if you're unsure, open a new ticket. Anyway, thanks for opening #6064. |
This issue is for the tracking of the review of the TypeScript signatures - that involve either an
Observable
orObservableInput
rest parameter or a callback that returnsObservableInput
or have open, type-related issues, etc. - as per the discussion in today's core-team meeting.Deprecations for the scheduler-related changes are not in this list. My understanding is that those deprecations will remain in place, with the breaking changes being made in version 8.
@benlesh As I've review individual source files, I'll check them off in this list if they're okay and will link to a comment (or issue) if changes are required or attention is warranted.
In addition to what's shown below, I think we should look at how
null
andundefined
are used to ensure that passing either- to indicate the absence of an argument - is supported.AsyncSubject.ts
BehaviorSubject.ts
Notification.ts
- see fix: fix up notification types #5478, use more exact return type in Notification#do #5031Observable.ts
- see Observable does not implement InteropObservable #3890, Refine subscribe and tap signatures #4159, RxJS incorrectly defines observable symbol #4415 and fix(toPromise): correct toPromise return type #5072Observer.ts
Operator.ts
ReplaySubject.ts
Scheduler.ts
Subject.ts
- see this commentSubscriber.ts
Subscription.ts
types.ts
- see from is typed to accept any Subscribable, but only accepts Observables with Symbol.observable #4532 and this comment and this commentobservable/bindCallback.ts
- needs N-args signature for values? Should fall back tounknown
instead ofany
. Also, see this comment.observable/bindNodeCallback.ts
- needs N-args signature for values? Should fall back tounknown
instead ofany
. Also, see this comment.observable/combineLatest.ts
- needs N-args signature for observable inputs? See also forkJoin should emit empty array or object given empty array or object as input #5209observable/concat.ts
observable/defer.ts
observable/dom/AjaxObservable.ts
observable/dom/WebSocketSubject.ts
observable/dom/ajax.ts
observable/dom/animationFrames.ts
observable/dom/fetch.ts
- see fromFetch cannot abort all responses #4744observable/dom/webSocket.ts
observable/empty.ts
observable/forkJoin.ts
- needs N-args signature for observable inputs? See also forkJoin should emit empty array or object given empty array or object as input #5209observable/from.ts
- see from is typed to accept any Subscribable, but only accepts Observables with Symbol.observable #4532observable/generate.ts
observable/iif.ts
observable/interval.ts
observable/merge.ts
- needs N-args signature for observable inputs?observable/never.ts
observable/of.ts
- see Update of.ts #5027observable/onErrorResumeNext.ts
- needs N-args signature for observable inputs?observable/pairs.ts
- seepairs
observable static function does not infers correctly #4468observable/partition.ts
observable/race.ts
- needs N-args signature for observable inputs?observable/range.ts
observable/throwError.ts
observable/timer.ts
observable/using.ts
- needs observable input factory handled?observable/zip.ts
- needs N-args signature for observable inputs? Also see forkJoin should emit empty array or object given empty array or object as input #5209operators/audit.ts
operators/auditTime.ts
operators/buffer.ts
operators/bufferCount.ts
operators/bufferTime.ts
operators/bufferToggle.ts
operators/bufferWhen.ts
operators/catchError.ts
operators/combineAll.ts
operators/combineLatest.ts
- see Rename all operators that are duplicates of static operators toxWith
variants #3927 and needs N-args signature for observable inputs?operators/concat.ts
- see Rename all operators that are duplicates of static operators toxWith
variants #3927 and needs N-args signature for observable inputs?operators/concatAll.ts
operators/concatMap.ts
operators/concatMapTo.ts
operators/count.ts
operators/debounce.ts
operators/debounceTime.ts
operators/defaultIfEmpty.ts
operators/delay.ts
operators/delayWhen.ts
operators/dematerialize.ts
(more work here fix: fix up notification types #5478)operators/distinct.ts
operators/distinctUntilChanged.ts
operators/distinctUntilKeyChanged.ts
operators/elementAt.ts
operators/endWith.ts
- needs N-args signature for values?operators/every.ts
operators/exhaust.ts
operators/exhaustMap.ts
operators/expand.ts
- needs observable input factory handled?operators/filter.ts
operators/finalize.ts
operators/find.ts
operators/findIndex.ts
operators/first.ts
operators/groupBy.ts
operators/ignoreElements.ts
operators/isEmpty.ts
operators/last.ts
operators/map.ts
operators/mapTo.ts
- see Amendment tomapTo
operator type #5090operators/materialize.ts
operators/max.ts
operators/merge.ts
- see Rename all operators that are duplicates of static operators toxWith
variants #3927 and needs N-args signature for observable inputs?operators/mergeAll.ts
operators/mergeMap.ts
operators/mergeMapTo.ts
operators/mergeScan.ts
operators/min.ts
operators/multicast.ts
operators/observeOn.ts
operators/onErrorResumeNext.ts
- needs N-args signature for observable inputs?operators/pairwise.ts
operators/pluck.ts
operators/publish.ts
operators/publishBehavior.ts
- see Add selector to publishBehavior #2845operators/publishLast.ts
operators/publishReplay.ts
- see Add selector to publishBehavior #2845operators/race.ts
- see Rename all operators that are duplicates of static operators toxWith
variants #3927 and needs N-args signature for observable inputs?operators/reduce.ts
operators/refCount.ts
operators/repeat.ts
operators/repeatWhen.ts
operators/retry.ts
operators/retryWhen.ts
operators/sample.ts
operators/sampleTime.ts
operators/scan.ts
operators/sequenceEqual.ts
operators/share.ts
operators/shareReplay.ts
operators/single.ts
operators/skip.ts
operators/skipLast.ts
operators/skipUntil.ts
operators/skipWhile.ts
operators/startWith.ts
- needs N-args signature for observable inputs?operators/subscribeOn.ts
operators/switchAll.ts
operators/switchMap.ts
operators/switchMapTo.ts
operators/take.ts
operators/takeLast.ts
operators/takeUntil.ts
operators/takeWhile.ts
operators/tap.ts
- see Refine subscribe and tap signatures #4159operators/throttle.ts
operators/throttleTime.ts
operators/throwIfEmpty.ts
operators/timeInterval.ts
operators/timeout.ts
operators/timeoutWith.ts
operators/timestamp.ts
operators/toArray.ts
operators/window.ts
operators/windowCount.ts
operators/windowTime.ts
operators/windowToggle.ts
operators/windowWhen.ts
operators/withLatestFrom.ts
- needs N-args signature for observable inputs?operators/zip.ts
- see Rename all operators that are duplicates of static operators toxWith
variants #3927 and needs N-args signature for observable inputs?operators/zipAll.ts
scheduled/scheduled.ts
The text was updated successfully, but these errors were encountered: