-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Unexpected deprecation warning after upgrading to TypeScript v4.2.2 #43053
Comments
+1 |
I have found this issue after upgrade vscode. |
Thank you for opening this issue - I have a huge |
Yeah, I think since version: 1.54.1 |
Same here after upgrade vscode |
After updating VSCode to 1.54.1. I started seeing these deprecation warnings. |
Same here. |
Same here |
Hi ! |
Same here |
Same issue after VSCode update Version: 1.54.1 (user setup) |
Ditto Version: 1.54.1 (user setup) |
Same as @jrdutton Version: 1.54.1 (user setup) |
FYI: The issue is still present with TypeScript 4.2.3 Looks like VSCode gives us all the |
Same issue here: looking forward for a fix. thank |
Hi folks, I'm not 100% that this is a TypeScript issue but an issue in both tslint and eslint which maybe aren't checking whether the used version of a function is deprecated. When you make a blank project with: mkdir 43053
yarn init -y
yarn add typescript rxjs
touch index.ts
code . Then open the file: We don't report to vscode that the former example is deprecated, which is what would happen if TypeScript thought it was deprecated. -- That said, there's a reasonable possibility that the underlaying deprecations API usage which tslint and eslint may be using could have changed in 4.2 though which might have caused this, which I'll be looking into next |
Thank god I thought I need to update the subscriptions to a new syntax ... |
I think we should open a issue on Eslint since tslint is now deprecated |
So far, I've narrowed it down to being a change in the returned values from With this script: import * as ts from "typescript";
// Loop through the AST to find call expressions:
function traverse(sourceFile: ts.SourceFile) {
lookAtNode(sourceFile);
function lookAtNode(node: ts.Node) {
if (ts.isCallExpression(node)) {
check(node)
}
ts.forEachChild(node, lookAtNode);
}
}
// Setup TypeScript environment
let program = ts.createProgram(["index.ts"], {});
let checker = program.getTypeChecker();
const sourceFile = program.getSourceFile("index.ts")!
traverse(sourceFile);
// Look at call expressions to see if they're deprecated based on code in tslint and SonarJS
function check(callExpression: ts.CallExpression) {
const tc = checker;
console.log("\n\nLooking at: ", callExpression.getText())
const signature = tc.getResolvedSignature(callExpression);
if (signature) {
const tags = signature.getJsDocTags()
const deprecated = tags.find(t => t.name === "deprecated")
if (deprecated) {
console.log("Deprecation from `getJsDocTags`", deprecated)
}
}
} In 4.1:
In 4.2:
It's unlikely this output is what we want, so hold off on new issues for other projects. |
Yes, I was about to say, even though VSCode no longer reports a deprecation warning after disabling TSLint & ESLint, changing between TypeScript 4.1.5 & 4.2.2 changes the content of the "documention popup" when hovering the Documention popup with TypeScript 4.1.5 : Documention popup with TypeScript 4.2.2 : Also, ESLint has no dependency on TypeScript, so it would be more likely be related to the eslint-plugin-deprecation which has been made based on SonarJS (in addition I just saw that an issue has been opened about TypeScript 4.2 support for SonarJS which may be related to the deprecation warnings we are seeing) |
OK, this looks like is an un-expected side-effect of #42098 Repro'd without the whole rxjs pipeline: interface PartialObserver<T> {}
interface Subscription {}
interface Unsubscribable {}
export interface Subscribable<T> {
subscribe(observer?: PartialObserver<T>): Unsubscribable;
/** @deprecated 1 Use an observer instead of a complete callback */
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Unsubscribable;
/** @deprecated 2 Use an observer instead of an error callback */
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Unsubscribable;
/** @deprecated 3 Use an observer instead of a complete callback */
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Unsubscribable;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Unsubscribable;
}
interface ThingWithDeprecations<T> extends Subscribable<T> {
subscribe(observer?: PartialObserver<T>): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription;
/** @deprecated Use an observer instead of an error callback */
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Subscription;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
}
declare const a: ThingWithDeprecations<void>
// Fails with the above script
a.subscribe(() => {
console.log('something happened');
}); The deprecations which are returned come from |
Same here, happened after updating to vscode 1.54.1 |
I am still getting this issue. Typescript 4.2.3, VScode 1.54.3 running on macOS Catalina. It also started happening after updating to VScode 1.54.1 |
+1 |
@sandersn can we open this issue? It come back again. |
Actually, it never disappeared ^^ The fix has not been merged for the 4.2.X branch yet, it has only been merged for the next 4.3.X release. You can track the merge progress for the 4.2.X branch here : #43180 |
so why this issue is closed? |
facing same issue |
Same here, problem not solved yet (waiting for 4.3.X release). |
Facing same issue for Typescript 4.2.3 Vs Code versions: |
+1 |
1 similar comment
+1 |
Re-opening until a 4.2 patch release, and brought up the request for a patch again 👍🏻 |
Same here, problem not solved yet (waiting for 4.3.X release). |
Same issue here I have tried everything no chance. |
Same issue here! Please let us know how avoid this warning! |
If you really need TypeScript 4.2 -> Wait for a patch If you don't need TypeScript 4.2 -> You can simply downgrade your project and VSCode to use TypeScript 4.1 |
You can also use the nightly version of the TS extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next |
Updated today to version 1.55 of VS code. The issue still persists. |
TypeScript 4.2.4 has now been released, so we can close this. A VSCode update should follow in about a week. |
have this issue solved? |
Using this #43053 (comment) to force VScode to use TypeScript v4.2.4 instead of v4.2.3 I can confirm the issue has been fixed. Unfortunately the branch for VSCode v1.55 still hasn't been updated with TypeScript v4.2.4. EDIT: Well, looks like we'll have to wait for VSCode v1.56 (scheduled for may), if we want to use the default TypeScript version of VSCode ^^ |
My 2 cents, I'm not sure this is the right place to post this, but a deprecation warning still occurs on a specific situation. /** @deprecated */
declare function bodyParser(
options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded,
): NextHandleFunction;
declare namespace bodyParser {
//...
/**
* Returns middleware that only parses json and only looks at requests
* where the Content-Type header matches the type option.
*/
function json(options?: OptionsJson): NextHandleFunction;
//...
} Using |
Today's update to VSCode sees it running Typescript 4.2.4 and the deprecation warning got Subscribe is no longer present! |
Plus one here, I'm facing the same issue. The problem is that on RxJS website is not explained well how the new code should look like. |
Bug Report
🔎 Search Terms
RxJS Deprecation Warning TSLint ESLint VSCode Signature Doc Tags DocTags
🕗 Version & Regression Information
Since TypeScript v4.2.2, I get deprecation warnings with RxJS, that I was not getting in TypeScript v4.1.5
I first opened an issue on RxJS (here), but it may be a TypeScript issue
💻 Code
🙁 Actual behavior
When I subscribe to the observable, I get the deprecation warning
subscribe is deprecated: Use an observer instead of a complete callback
even though I'm not using any complete callbackIt occurs with both TSLint v6.1.3 and ESLint v7.21.0 (using eslint-plugin-deprecation v1.2.0)
Here are the signatures for the
subscribe
method in RxJS v6.6.6 :If I understand this correctly, in my case it should be using this signature :
Which is not deprecated
🙂 Expected behavior
There should be no deprecation warning
The text was updated successfully, but these errors were encountered: