Elide re-exports of unresolved type-only imports - #56449
Conversation
| const target = getExportSymbolOfValueSymbolIfExported(resolveAlias(symbol)); | ||
| if (target === unknownSymbol) { | ||
| return true; | ||
| return !excludeTypeOnlyValues || !getTypeOnlyAliasDeclaration(symbol); |
There was a problem hiding this comment.
Does this need a test for the other condition? I think the test covers the latter only.
There was a problem hiding this comment.
!excludeTypeOnlyValues is never covered under any test because I’m pretty sure it’s never correct to pass false for that. I fixed one case that forgot to pass true for it in #55097, and the last remaining caller didn’t change any baselines when I had it pass true. I made a note to look at it and probably remove the parameter altogether in a follow-up PR.
There was a problem hiding this comment.
Oh yeah, the last place that doesn’t pass true is checking whether to elide an ImportEqualsDeclaration, which doesn’t strictly matter because it’s not a runtime error to require() a module that doesn’t export anything. But it should probably be elided anyway, so it’s likely that parameter will go away and we’ll treat it as if it’s always true.
There was a problem hiding this comment.
Sounds good, thanks!
|
TypeScript Bot (@typescript-bot) cherry-pick this to release-5.3 |
|
Heya Andrew Branch (@andrewbranch), I've started to run the task to cherry-pick this into |
|
Hey Andrew Branch (@andrewbranch), I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into release-5.3 manually. |
Fixes #56445