Skip to content

Invalid quickfix output for code fix all for infer type from usage #24148

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

Closed
mhegazy opened this issue May 15, 2018 · 2 comments
Closed

Invalid quickfix output for code fix all for infer type from usage #24148

mhegazy opened this issue May 15, 2018 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mhegazy
Copy link
Contributor

mhegazy commented May 15, 2018

TypeScript Version: 2.9.0-dev.201xxxxx

Search Terms:

Code

let x = null;

function foo () {
    if (!x) {  // CodeFix all
        x = 22;
    }
}

function bar() {
    console.log(x);
}

Expected behavior:

let x: number | null = null;

function foo () {
    if (!x) {
        x = 22;
    }
}


function bar() {
    console.log(x);
}

Actual behavior:

let x: number: number: number = null;

function foo () {
    if (!x) {
        x = 22;
    }
}

function bar() {
    console.log(x);
}

Playground Link:

Related Issues:

@mhegazy mhegazy added the Bug A bug in TypeScript label May 15, 2018
@mhegazy mhegazy assigned ghost May 15, 2018
@mhegazy mhegazy added this to the TypeScript 2.9.1 milestone May 15, 2018
@ghost
Copy link

ghost commented May 16, 2018

Fixed the duplicate-change error in #24169; moved the missing null issue to #24168 since it's a separate problem unrelated to fix-all.

@ghost ghost added the Fixed A PR has been merged for this issue label May 16, 2018
@ghost
Copy link

ghost commented May 16, 2018

Never mind, that one's easy to fix too so did both in #24169.

@ghost ghost closed this as completed in #24169 May 16, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

1 participant