Declaration emit inlines types incorrectly #57779
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
declaration emit inline
π Version & Regression Information
I was unable to test this prior to 4.4 since React types are no longer compatible with that version.
β― Playground Link
No response
π» Code
Full repro: https://github.com/eps1lon/ts-module-auto-export/tree/bad-inline
π Actual behavior
Return value from
render()
is not referencingReact.ReactNode
but inlines its (incomplete) union members:π Expected behavior
Return type references the type alias. Inlining union members is incorrect (we may add or remove members or treat members as internal, local types) generally and here specially not even using all members.
Additional information about the issue
The fact that it inlines the type here is a special case of #37151. #37151 is a more general since it's not always clear when inlining is correct or not. I'd be curious to know what would break if TS would not stop inlining in this special case.
But this issue is also broader since the inline is incomplete.
The text was updated successfully, but these errors were encountered: