question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

generic type interface with template literal string wrong generate implemented function

See original GitHub issue

TS Template added by @mjbvz

TypeScript Version: 4.3.0-dev.20210228

Search Terms

  • implement interface
  • quick fix

  • VS Code Version: 1.53.2
  • OS Version: Darwin x64 19.6.0
  • typescript version: 4.1.5

Steps to Reproduce:

i make generic type interface with template literal string, and i use implements this type in class. but vscode quick auto make interface feature wrong work. please look below screenshot.

image

i expect when i use implements interface and auto make interface function, setName(arg: string), setAddress(arg: number) maked . but in present name: (arg: string) and address: (arg:number) maked. so make type error in vscode…

image

but when i make this function myself, not make type error in vscode…

why generate implement function code wrong work with template literal string?

Does this issue occur when all extensions are disabled?: Yes

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
siosio34commented, Apr 13, 2021

@RyanCavanaugh hmm… if you time is okay, can you tell me what fix file for fix this bug?

0reactions
a-tarasyukcommented, Nov 15, 2021

@andrewbranch Oke, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript constrain generic to string literal type for use in ...
I can write a function that does what I want, but I don't know how to express the constraint that its argument type...
Read more >
Taming Strings with Template Literal Types - SitePen
As we saw above, template literals are used to generate strings using a combination of string literals and data. On the other hand,...
Read more >
Type safety with TemplateStringsArray and tag functions #33304
I tried to make the template more generic with T extends string[] (for testing) then tried to see if I could check the...
Read more >
Documentation - Template Literal Types - TypeScript
Generating mapping types which change properties via template literal strings.
Read more >
How To Use Generics in TypeScript - DigitalOcean
Generics can appear in functions, types, classes, and interfaces. ... extensions as an array of strings, the variable ageAndExtensions will ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found