Closed
Description
Bug Report
The "Quick Feature" allows us to generate a missing a function, but doesn't correctly declare that function when its parameters include a type parameter.
See also unexpected behavior when type narrowing in this example.
🔎 Search Terms
- add missing function declaration
- generic type parameter
🕗 Version & Regression Information
I am unable to find a version of TypeScript where this was not a problem.
⏯ Playground Link
Playground link with relevant code
💻 Code
function identity<T>(self: T) {
// To reproduce the bug, Quick Fix > Add missing function declaration
runEvilSideEffect(self)
return self;
}
🙁 Actual behavior
TypeScript generated this function, which is an invalid function declaration:
function runEvilSideEffect(self: T) {
throw new Error("Function not implemented.");
}
🙂 Expected behavior
function runEvilSideEffect<T> (self: T) {
throw new Error("Function not implemented.");
}