Discrepancy when typeToString when enclosingDeclaration is undefined vs defined. #43988
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Bug Report
I'm using
typeToString
functionality from the typescript compiler (via ts-morph) to build auto-generated API documentation. I've run into an issue with certain types that use default generic types. My goals:If I pass
enclosingDeclaration
, the default parameters don't show up, but the import is gone. If I don't passenclosingDeclaration
the opposite happens - import is there, but the default parameters show up.🔎 Search Terms
Typescript typeToString generic optional default parameter ignore enclosingDeclaration
🕗 Version & Regression Information
I'm not sure this is bug but there is nothing I could find about it anywhere else.
⏯ Playground Link
link
Code sandbox which shows the issue.
💻 Code
Types:
🙁 Actual behavior
🙂 Expected behavior
I'm trying to get
() => import("/Users/path/to/file").WithDefaultGenerics
The reason this is important to me is because in conjunction with, I suspect, this issue, getting a type for
(props: AllCasesProps) => ReactElement<AllCasesProps>
ends up looking like this:The text was updated successfully, but these errors were encountered: