-
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
startWith Deprecation warning #4772
Comments
The problem is related to the issue you referenced only in that some operators and observable creators that have signatures that include a In your case, export function startWith<T>(scheduler: SchedulerLike): MonoTypeOperatorFunction<T>; And it only matches that signature because you most likely have Given that this is not a problem for in situations in which // tslint:disable-next-line:deprecation
startWith(null) |
Do you mean in tslint.json? I don't see that setting but I will try adding it and see if it makes a difference. The warning fires for undefined aswell as null too. |
The comment I mentioned is a rule flag and goes into the source - immediately above the line that effects the error. Or you can configure the "deprecation": { "severity": "warning" }, Without |
I wish I'd known about strictNullChecks when we started this application ... Unfortunately this is not an easy switch for us and thus I won't be able to confirm whether this resolves the problem for some time. I'm happy to delegate that to someone else with the same problem. |
@internalsystemerror Regarding enabling |
@cartant thank you ... its the part "(I will add that if you are starting a new TypeScript project, do your future self a favour and start with "strict": true as the default.)" that I wish I'd have known :D. Definitely going to be using that going forward and retrospectively on this current application when possible. |
The deprecation warning also disappears when typing the
|
@cartant, I haven't checked... is this something we can remedy by changing the order of typings for |
@benlesh I don't see how it could be rearranged without changing the behaviour of the types. ATM, a lone scheduler argument is seen as a scheduler. If the order is changed, it will be seen as a value - as far as the type system is concerned. Admittedly, this is a pretty unlikely use case, but the signature that's causing the problem is there because it's behaviour supported by the implementation. If you want to fix the 90% case - that is, fixed for at least 90% of the people not using |
Coming from Angular, I run into it when using a pattern like
since |
For me, I hit this and read this thread, and found that typeing the reference made the issue go away without any further problems.
|
|
Here's another hacky fix: const nullValue = null;
startWith(nullValue); |
No hacks (obfuscating) or cheats (tslint:disable comments) please. Also null is not a string. (no cast). What's the problem if I expect (and my type is set to) optionally null? e.g. An array which could contain null values. But the deprecated error on using My current alternative for a specific case (text input element) is to use an empty string |
I have |
startWith<any,any>(blah) |
Closing this because it's addressed in #6114. |
I can't find any documentation on what is actually deprecated, but I believe this is related to: #4723.
Bug Report
Current Behavior
startWith is deprecated: use {@link scheduled} and {@link concatAll} (e.g.
scheduled([[a, b, c], source], schedul er).pipe(concatAll())
)Reproduction
Expected behavior
No deprecation warning
Environment
The text was updated successfully, but these errors were encountered: