File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ export const extractTypeAlias = async (
2929} ) ;
3030
3131const typeAliasSignature = async ( declaration : TypeAliasDeclaration ) : Promise < string > => {
32+ // Using `declaration.getType().getText(declaration);` returns the expanded/resolved type.
33+ // However this causes:
34+ // - inline imports like `import('...').SomeType` to appear in the signature
35+ // - types can become really long in some cases as they are expanded by the compiler
36+ // - format flags like `TypeFormatFlags.NoTruncation | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope`
37+ // seem to be ignored or cause local types to be resolved to their name like `type Foo = Foo;`
38+ // For these reasons we simply get the type alias text as written by authors.
39+ // See:
40+ // - https://github.com/dsherret/ts-morph/issues/453#issuecomment-427405736
41+ // - https://twitter.com/drosenwasser/status/1289640180035403776
3242 const signature = declaration . getText ( ) ;
3343 return formatSignature ( "type" , signature ) ;
3444} ;
You can’t perform that action at this time.
0 commit comments