Skip to content

Incorrect TS7022 error displayed by Language Server in VSCode #766

Closed

Description

@martaver
  • VS Code Version: 1.83.0
  • OS Version: MacOS Monterey 12.4 (but also shown in vscode on other MacOS versions)

Steps to Reproduce:

  1. Clone https://github.com/cleric-sh/repro/tree/phantom-ts7022-error-in-vscode
  2. Ensure switched to branch phantom-ts7022-error-in-vscode
  3. npm i
  4. npm compile --> observe no compiler errors
  5. Open index.ts
  6. Make a change to the file (e.g. add a space) to trigger LSP to re-analyse the file.
  7. Restart the TS Language Server and error disappears. Make a change, and error re-appears.
  8. Error should appear on value on line 26.

The error appears with all extensions disabled.

I've noted that the error is:

  • Only shown when func param 'arg' type is declared. Removing the declaration resolves the error.
  • Only shown in vscode. tsc compiles without errors.
  • Only shown on second pass, after a change has been made to the file. Initial type check on load shows no errors.
  • Only shown when noImplicitAny: true

Also, in a more complex file, declaring this function after doAnotherThing prevents the error being displayed.

All these points combined lead me to believe this is an error either in VS Code or the Typescript Language Server.

I've also created an issue in the VSCode GitHub repo: microsoft/vscode#195075

Activity

  1. martaver commented on Oct 7, 2023

    @martaver
    Author

    I added tsserver.log to the repro, which covers starting TS Language Server and making a change to the file.

  2. martaver commented on Oct 7, 2023

    @martaver
    Author

    Possibly related to issue: microsoft/vscode#177595

  3. rchl commented on Oct 20, 2023

    @rchl
    Member

    Based on the linked issue it seems like the issue was fixed in typescript.

  4. martaver commented on Oct 23, 2023

    @martaver
    Author

    Based on the repro I provided, in vscode insiders with typescript@beta, the error is still present. This issue should still be open.

  5. rchl commented on Oct 23, 2023

    @rchl
    Member

    It's not likely that this issue is in this server. I would suggest reporting it in the typescript repo since it reproduces with VSCode also which doesn't use this server.

  6. martaver commented on Oct 23, 2023

    @martaver
    Author
  7. rchl commented on Oct 23, 2023

    @rchl
    Member

    I can reproduce the issue but this server is just a thin LSP layer on top of the Typescript tsserver API.

    I can address issues that are specific to this LSP layer maintained here but if the issue appears to be deep in typescript's core then I'm not willing to spend hours or days of my free time debugging the issue.

    Since it reproduces in VSCode, creating a bug report in Typescript repo should get the attention of the right people. It looks like an issue that is specific to the tsserver API that Typescript exposes and that's why it reproduces both in VSCode and with this server which is based on VSCode's implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions