You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
autocomplete workaround for string literal inside template literal stopped working since v5.3.3 #57902
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.
My understanding from the design meeting discussions surrounding #56434 (#56450 ?) is that doing that was a problem as it involved traversing deeply into the elements (which I originally added but Anders removed?)
I know that this is a lame way to express hierarchal data, but unfortunately I don't get a choice.
In this situation I get an autocomplete of... nothing, woe is me 😄
Activity
Andarist commentedon Mar 22, 2024
This one works today:
It likely has changed in #56434
jakebailey commentedon Mar 22, 2024
Yes, that was the intended change for people to make:
Of course, that doesn't work before TS 5.3. See also #54188 (#56434 was in 5.4 which "finalized" the behavior).
RyanCavanaugh commentedon Mar 22, 2024
Would accept a (very) non-invasive/non-impactful PR to allow both workarounds to work
jakebailey commentedon Mar 22, 2024
My understanding from the design meeting discussions surrounding #56434 (#56450 ?) is that doing that was a problem as it involved traversing deeply into the elements (which I originally added but Anders removed?)
RyanCavanaugh commentedon Mar 22, 2024
What's the right tag for "PRs accepted but you'll likely have to be more clever than the entire TS team to figure it out"...
jakebailey commentedon Mar 22, 2024
cursed
fatcerberus commentedon Mar 22, 2024
The
Cursed?tag doesn't get used often so it's always a hoot when I see it. I love that it exists.TkDodo commentedon Jan 24, 2025
I can’t get this to work in any version of TS. Here’s the code in v5.7:
https://www.typescriptlang.org/play/?ts=5.7.3#code/C4TwDgpgBAYg9nKBeKByA9AMwaqAfNLBdALgEsATXAgCgAMi50ASAbwGdgAnMgOwHMAvnSgAyKK0EBKAFAyAxnF6coAIwCGXErATI0qIA
Not only does it not appear in the list for auto complete - empty string is also not assignable to type
Foo.Andarist commentedon Jan 24, 2025
It's not clear to me what your expected result is. Have you expected
/foo/to be suggested?TkDodo commentedon Jan 24, 2025
Sorry about that. I also just saw my expectation is a bit different from OPs, too.
In my case, I have a list of strings (known api urls) that I would like to see in auto complete:
playground
Currently, only
/foo/shows up. Ideally, I would also get to see/barand/bazsomehow in the auto complete listAndarist commentedon Jan 24, 2025
You are looking for this then: #59794
datner commentedon Feb 6, 2025
I am in the exact same situation like Dom, my case looks a bit more like this though:
I know that this is a lame way to express hierarchal data, but unfortunately I don't get a choice.
In this situation I get an autocomplete of... nothing, woe is me 😄
RyanCavanaugh commentedon Dec 3, 2025
Closing language service bugs related to the 6.0 implementation. For more information, see #62827