Arrow function parameters using an alias and intersection are expanded inappropriately in .d.ts
#55575
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
π Search Terms
arrow function type alias parameters expansion intersection
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.3.0-dev.20230830#code/JYWwDg9gTgLgBAbzgBShMBnOBfOAzNEOAIigFMBDAYxgFoMyAbMm4gbgCgOyAPSWOFQgA7DPADCAVzEQQAZSYsYARjgBeOAB4A8mBjARAGgB8ACh4AuFGkw69B4YfwVGDY3ABkibAEp17hGxuPmh4PElhGgc4KRl5RRoAJjt9IzNLa3QMFIcnPBc3T28-QKA
π» Code
π Actual behavior
The output
.d.ts
incorrectly expands the importedProps
alias. Note that it has incorrectly resolved the default parameter.π Expected behavior
The imported type alias
Props
must not be expanded, if the upstream package changes its defaults this will cause confusion because dependencies relying on the defaults will not be able to use the new default.Additional information about the issue
This problem became much worse with the advent of 4.2.3, with prior version of typescript only mistakenly expanding the default argument.
Additionally this causes difficult-to-reproduce issues producing errors like
because the expanded alias uses types that aren't imported.
The text was updated successfully, but these errors were encountered: