Skip to content

Completion after initialized class property with const assertion and no semicolonΒ #62487

@mpal9000

Description

@mpal9000

πŸ”Ž Search Terms

"completion", "class", "semicolon"

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried (3.6.2 - 5.9.2, nightly, 7.0.0-dev.20250925.1), and I reviewed the FAQ for entries about 5.9.2

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgILIN4ChnLgIwQC5kQBXAW32h2QBMIYSBnMKUAcywF8ssEANnGbNkAIWTAKABwEQKEcKPTZcBBMgC8yAIx5RCAPYhWPIA

πŸ’» Code

interface A {
  abc: number
  def: string
}

class B implements A {
  abc = 1 as const
}

πŸ™ Actual behavior

Completion doesn't seem to work as expected, after the abc = 1 as const assignment. I can see no suggestion for def property. It works if the assignment is followed by a semicolon, if the const assertion is removed or if completion is triggered before the assignment.

πŸ™‚ Expected behavior

See a suggestion for def property, when triggering completion manually or automatically, after the abc = 1 as const assignment.

Additional information about the issue

I can see the same issue with tsgo (7.0.0-dev.20250925.1) as well.

Related issues (without const assertions): #52212, #46833, #30536

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Completion ListsThe issue relates to showing completion lists in an editorHelp WantedYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions