Skip to content

TypeScript gets into bad editing state with async arrow functions #37522

Closed

Description

This seems to be an issue with 3.8 and newer. 3.7.5 doesn't exhibit this behavior.

There's a couple of ways to observe this. First, try writing out the following code character-by-character.

let x = async () => {
    
}

You'll get

let x = async () => {
        ~~~~~~~~
Cannot find name 'async'.

Alternatively, paste the full example into a buffer. Then erase the c in async.

let x = asyn () => {
    
}

Give it a second, then add it back. TypeScript doesn't seem to refresh its semantic diagnostics for some reason.

You'll get

let x = async () => {
        ~~~~
Cannot find name 'asyn'.

Activity

  1. DanielRosenwasser commented on Mar 23, 2020

    @DanielRosenwasser
    MemberAuthor

    First time I can see this behavior is 3.8.0-dev.20191219.

  2. DanielRosenwasser commented on Mar 23, 2020

    @DanielRosenwasser
    MemberAuthor

    https://github.com/microsoft/TypeScript/pulls?q=is%3Apr+closed%3A2019-12-17..2019-12-19+is%3Aclosed might be (?) a reasonable filter to figure out what started this.

  3. DanielRosenwasser commented on Mar 23, 2020

    @DanielRosenwasser
    MemberAuthor

    I'm not 100% sure, but I'm fairly certain this is caused by #35731. It's one of the only parser changes, and switches a lot of parsing checks on arrow functions to check the modifier list instead of ModifierFlags. Maybe Andrew Branch (@andrewbranch) (and even Cyrus Najmabadi (@CyrusNajmabadi), hi!) can help out here.

  4. andrewbranch commented on Mar 26, 2020

    @andrewbranch
    Member

    I am interested in incremental parsing and have a vague high-level familiarity with the algorithm, so if Nathan Shively-Sanders (@sandersn) runs out of time, wants a hand, or just wants to pawn this one off, I’d be happy to take a look.

  5. sandersn commented on Apr 1, 2020

    @sandersn
    Member

    I'm very likely to be out of time for this release, and I'm not familiar with the algorithm. So I'll give it to you, Andrew Branch (@andrewbranch)

    I remember that PR was the second attempt, after Pranav Senthilnathan (@PranavSenthilnathan) and I abandoned the first attempt as "probably a bad idea". It might still be a bad idea!

  6. andrewbranch commented on Apr 2, 2020

    @andrewbranch
    Member

    Daniel Rosenwasser (@DanielRosenwasser) I can’t reproduce this in VS Code with 3.8.0-dev.20191219, 3.8.3, or current master, or in the playground. Are there any other tricks to get this to happen?

  7. andrewbranch commented on Apr 8, 2020

    @andrewbranch
    Member

    Daniel Rosenwasser (@DanielRosenwasser) are you still able to reproduce this?

  8. andrewbranch commented on Apr 13, 2020

    @andrewbranch
    Member

    No one can reproduce this so I’m going to close... 😬

  9. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions