-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[api-extractor] Fix 'export * as __' part of #3593
"Incorrect canonical reference to aliased class in .api.json" #3593 This fixes the other aliasing, namely through (nested) namespaces. Added a test scenario "docReferencesNamespaceAlias", which consists of nested namespaces that have their own index.d.ts, re-exporting the default export of each sibling file and their respective sub-namespace (top-level -> 'renamed' -> 'sub'). The *.api.json canonicalReferences now correctly use the nested namespace "fully-qualified name". Again, some other test result changed unexpectedly, maybe revealing an existing bug / wrong expected result. The scenarios are "exportImportStarAs2", "importEquals" and "includeForgottenExports". The pattern is that before, namespace and class were separate tokens, but are now aggregated to one dot-separated expression. I hope that these are improvements, but I am not sure, so this should be reviewed. Implementation: --------------- When DeclarationReferenceGenerator#_getParentReference() looks for a parent symbol, it must also resolve namespace parent symbols the Collector derived from 'import * as ___'. To that end, Collector now has a method getExportingNamespace() that pulls namespace imports from the CollectorEntities of a namespace symbol (if present). For that, namespace imports are now also registered in the _entitiesBySymbol Map. In DeclarationReferenceGenerator, the handling of namespaces had to be improved. _getNavigationToSymbol() now detects namespaces, even behind an alias, and then always returns "." as separator. To find the parent, it also considers namespaces now. _symbolToDeclarationReference() takes care not to follow an alias that leads to a *-imported namespace, because the target is the imported source file that no longer allows to retrieve the namespace name.
- Loading branch information
Showing
16 changed files
with
574 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.