-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
method.getSignature().getReturnType().getText() returns union type instead of type alias in 10.x #943
Comments
@AlCalzone this functionality is all from the compiler API so this was because of TS 4.2, likely the "Smarter Type Alias Preservation" change: https://devblogs.microsoft.com/typescript/announcing-typescript-4-2/#smarter-type-alias-preservation It looks like in this case it's not doing a great job. How does it display in your editor when your editor is using TS 4.2? |
That's more what I would expect (because of the |
@AlCalzone Maybe try providing |
I can reproduce on the TS playground that this regressed in 4.2.2: No dice with |
@AlCalzone hmmm... must be a way considering the language service shows that. I think though that |
But I could get to the type the language service prints by changing the scope for |
@AlCalzone oh, you are right! I was lazily/incorrectly only looking at the |
I am using ts-morph to auto-generate documentation for a project of mine and just upgraded from ts-morph from 9.1.0 to 10.0.1.
Describe the bug
Version: 10.0.1
Prior to the upgrade, this method had an inferred return type of
whereas after the update, the return type gets printed as
where
currentValue
gets printed with the union type behindMaybe<boolean>
.I have verified with
git bisect
that the culprit is indeed not the update to TypeScript 4.2, but the ts-morph update. I didn't find anything regarding this change in the changelog, so I'm assuming it is not intended.To Reproduce
Expected behavior
No changes to
docs/api/CCs/BinarySwitch.md
like before the update.The text was updated successfully, but these errors were encountered: