Make exportSymbol public (#17457)

* Make exportSymbol public

* Add a `getExportSymbolOfSymbol` method

* Use own implementation instead of delegating to `getExportSymbolOfValueSymbolIfExported`
This commit is contained in:
Andy 2017-08-14 09:20:48 -07:00 committed by GitHub
parent ea7c7d3467
commit 543e0affff
2 changed files with 12 additions and 0 deletions

View file

@ -138,6 +138,9 @@ namespace ts {
node = getParseTreeNode(node, isExportSpecifier);
return node ? getExportSpecifierLocalTargetSymbol(node) : undefined;
},
getExportSymbolOfSymbol(symbol) {
return getMergedSymbol(symbol.exportSymbol || symbol);
},
getTypeAtLocation: node => {
node = getParseTreeNode(node);
return node ? getTypeOfNode(node) : unknownType;

View file

@ -2568,6 +2568,15 @@ namespace ts {
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
/**
* If a symbol is a local symbol with an associated exported symbol, returns the exported symbol.
* Otherwise returns its input.
* For example, at `export type T = number;`:
* - `getSymbolAtLocation` at the location `T` will return the exported symbol for `T`.
* - But the result of `getSymbolsInScope` will contain the *local* symbol for `T`, not the exported symbol.
* - Calling `getExportSymbolOfSymbol` on that local symbol will return the exported symbol.
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;