We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: 4.1.0-dev.20200907
Search Terms: isContextSensitive
Code
declare function foo<T = number>(): T; const result: string = foo();
Apply "Extract to constant in enclosing scope" refactor on foo() expression
foo()
Expected behavior:
const newLocal: string = foo(); const result: string = newLocal;
Actual behavior:
const newLocal = foo(); const result: string = newLocal;
It doesn't seem to be intentional based on this code, and it works in this example:
const result: { x: (x: string) => string } = { x: (x) => x };
const newLocal: { x: (x: string) => string; } = { x: (x) => x }; const result: { x: (x: string) => string } = newLocal;
Playground Link: https://www.typescriptlang.org/play?ts=4.1.0-dev.20200907#code/CYUwxgNghgTiAEAzArgOzAFwJYHtVJxwB4AVeAXnlWQFsAjEGAPgAoBKALnhIG4AoMHgDOGeHCHIIGLiJhZUAcwoEc7HkA
Related Issues:
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
TypeScript Version: 4.1.0-dev.20200907
Search Terms: isContextSensitive
Code
Apply "Extract to constant in enclosing scope" refactor on
foo()
expressionExpected behavior:
Actual behavior:
It doesn't seem to be intentional based on this code, and it works in this example:
Playground Link: https://www.typescriptlang.org/play?ts=4.1.0-dev.20200907#code/CYUwxgNghgTiAEAzArgOzAFwJYHtVJxwB4AVeAXnlWQFsAjEGAPgAoBKALnhIG4AoMHgDOGeHCHIIGLiJhZUAcwoEc7HkA
Related Issues:
The text was updated successfully, but these errors were encountered: