[isolatedDeclarations] Optional parameter properties are unnecessarily disallowed in isolatedDeclarations mode #61501
Labels
Needs Investigation
This issue needs a team member to investigate its status.
🔎 Search Terms
optional parameter properties, isolated declarations, TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?downlevelIteration=true&importHelpers=true&target=99&module=1&isolatedDeclarations=true&ts=5.8.2&ssl=6&ssc=2&pln=1&pc=1#code/C4TwDgpgBAsghiARhAqgOwCYQGYEs0QZQC8UaArgLbIBOUAPlOZjvoQNwBQokUAchABuEGuix4CRUhWoiunCAA8wAexrAoAYwA2cAM56oAMRUqoAb05RrWlWj3Aa5TcDUAKGhDgY72kFEUAfgAuWARkMVZJABooT29ffxAQ-iERSIlCAEoLAF9OXKA
💻 Code
🙁 Actual behavior
Gives an error:
🙂 Expected behavior
It seems like this could be safely supported by just always emitting the class fields with a type of
|undefined
whether that was redundant or not, something like:Additional information about the issue
The workaround of explicitly adding
|undefined
to the parameter property types is not too onerous, but still seems like an unnecessary restriction forisolatedDeclarations
mode.The text was updated successfully, but these errors were encountered: