Declaration emit incorrectly prints uninstantiated generic type #44727
Labels
Bug
A bug in TypeScript
Domain: Declaration Emit
The issue relates to the emission of d.ts files
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
I have a type with an unused generic type parameter.*
This type annotates an optional parameter property in the constructor of a class.
Starting with Version 4.2.X of TypeScript, this class is incorrectly transpiled, so that TS code using the transpiled sources (.d.ts) does not transpile anymore.
The error was:
No wonder it cannot be found, it was not in the original code (please see the minimal example below).
During my investigation I found that this issue occurs, when these prerequisites are met:
This list might not be complete or exact.
* (Tried something. Didn't work. Postponed it, but left the parameter for later use.)
🔎 Search Terms
generics, transpilation, missing parameter
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
Before transpilation:
After transpilation
🙁 Actual behavior
The code is transpiled to contain the generic parameter name, instead of the actual type that was passed as argument.
🙂 Expected behavior
I would expect the result to contain the original type as specified in the original code. The generic parameter is not known when consuming the type. This worked before version 4.2.X.
The text was updated successfully, but these errors were encountered: