Skip to content

Allow to extract code containing return statement if it's at the end of a function #18256

Open
@ghost

Description

TypeScript Version: nightly (2.6.0-dev.20170904)

Code

export function f() {
    if (1) {
        return 1;
    }
    
    ...do stuff...
}

export function g() {
    ...do stuff...

    if (1) {
        return 1;
    }
}

Expected behavior:

Able to extract the if statement out of g.
Not able to extract from f because that would change the control flow.

Actual behavior:

Not able to extract in either case. (But somehow it works in #18091?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions