Skip to content
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

2.1 Regression: Definite assignment with try..finally #12355

Closed
jods4 opened this issue Nov 18, 2016 · 2 comments
Closed

2.1 Regression: Definite assignment with try..finally #12355

jods4 opened this issue Nov 18, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@jods4
Copy link

jods4 commented Nov 18, 2016

TypeScript Version: 2.1.? / the one that comes with VS 2017 RC

Code

async function bug() {
    let response: Response;
    try {
        response = await fetch("www.google.com");
    }    
    finally {
    }
    if (response.ok)  // <- error: Variable response is used before being assigned
        console.log("ok");
}

Expected behavior: was compiling (and working) fine in TS 2.0

Actual behavior: Error: response is used before being assigned.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 18, 2016

looks like a duplicate of #12205

@mhegazy mhegazy added the Duplicate An existing issue was already created label Nov 18, 2016
@jods4
Copy link
Author

jods4 commented Nov 18, 2016

I didn't see that one, it looks like a dup indeed.

@jods4 jods4 closed this as completed Nov 18, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants