Skip to content

autocomplete workaround for string literal inside template literal stopped working since v5.3.3Β #57902

Open
@GrtDev

Description

@GrtDev

πŸ”Ž Search Terms

string literal autocomplete template

πŸ•— Version & Regression Information

  • This changed between versions 5.3.2 and 5.3.3

⏯ Playground Link

https://www.typescriptlang.org/play?ts=5.3.3#code/C4TwDgpgBAYg9nKBeKByA9AMwaqAfNLBdALgEsATXAgAyLnQBIBvAZ2ACcyA7AcygBkUZgF8RNAFASAxnG7soAIwCGHEvEQpUqIA

πŸ’» Code

type Foo = '/foo' | '/foo/:id' | `/foo/${string & {}}`

const bar:Foo = ''

πŸ™ Actual behavior

bar only gives /foo as a suggestion.

πŸ™‚ Expected behavior

bar gives /foo and /foo/:id as a suggestion.

Additional information about the issue

I understand that the autocomplete is a longer ongoing issue in combination with string literals. However there was a workaround described in (among other places): #29729

This workaround (string & {}) still works as long as it is not inside a template literal. But stopped working inside a template literal since v5.3.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Cursed?It's likely this is extremely difficult to fix without making something else much, much worseDomain: 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