Skip to content

Unexpected circularly references error in VSCode #50795

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
whzx5byb opened this issue Sep 15, 2022 · 2 comments Β· Fixed by #52696
Closed

Unexpected circularly references error in VSCode #50795

whzx5byb opened this issue Sep 15, 2022 · 2 comments Β· Fixed by #52696
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@whzx5byb
Copy link

Bug Report

πŸ”Ž Search Terms

πŸ•— Version & Regression Information

  • This changed between versions 4.6.4 and 4.7.3

⏯ Playground Link

cannot reproduce in playground

πŸ’» Code

function fn(Foo: number) {
    type Foo = typeof Foo;

    return 0 as any as {x: Foo};
}

πŸ™ Actual behavior

In vscode with TS version > 4.6.4 it reports 'Foo' is referenced directly or indirectly in its own type annotation.ts(2502). But it works well in the playground.

This is first reported by @TechQuery in #50792 (comment), and I realize it may be related to #50161 and #50191 since the behavior is quite similar.

πŸ™‚ Expected behavior

No error.

@DanielRosenwasser DanielRosenwasser added Needs More Info The issue still hasn't been fully clarified Bug A bug in TypeScript Needs Investigation This issue needs a team member to investigate its status. and removed Needs More Info The issue still hasn't been fully clarified labels Sep 15, 2022
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.9.1 milestone Sep 15, 2022
@JoshuaKGoldberg
Copy link
Contributor

I think this is another symptom of the same issue, this time with a default value of a parameter: [TypeScript playground]

type GenericType<T extends string = string> = undefined;

export const genericArrowFunction = <T extends string>(
  options: GenericType<T> = "" as typeof options
) => undefined;
'options' is referenced directly or indirectly in its own type annotation.

@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Feb 1, 2023
@jakebailey jakebailey added Fix Available A PR has been opened for this issue and removed Fix Available A PR has been opened for this issue labels Feb 8, 2023
@jakebailey
Copy link
Member

Two words: semantic tokens.

This appears to have the same sort of problem that #50161 had, but thankfully can be tested in the same way as in #52373 as well, so I can reproduce it reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status. Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
6 participants