IsolatedDeclarations: emitted declarations inconsistent between transpileDeclaration
API and TypeScript Playground
#60031
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Acknowledgement
Example
Playground Link
This example is correct because the
tsc
checker analyzerComment
is a const variable defined in@vue/runtime-core
. So theComment
who referenced bycomment
is actually referenced lib.dom.d.ts'sComment
. But the output of this example intranspileDeclaration
APi will same as the following example.Another example
Playground Link
This example is also correct because the
tsc
checker can't analyze whatComment
is, so theComment
was kept in the output as it has been referenced bycomment
.But If I want to use lib.dom.d.ts's
Comment
rather than imported it will be incorrect.Expect Behaviour
In
IsolatedDeclarations
, Ideally, we shouldn't analyze imports, but if we stop analyzing, this will generate incorrect output.So I suggest
tsc
should throw an error about the above cases whenIsolatedDeclarations
is enabled. This is also beneficial for third-partyIsolatedDeclarations
implementations.BTW this issue I found when I fix the output mismatch between
oxc-isolated-declarations
andtsc
The text was updated successfully, but these errors were encountered: