mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-11 06:02:53 -05:00
Add a comment in getTypeOfAlias
This commit is contained in:
@@ -2415,6 +2415,12 @@ module ts {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
let targetSymbol = resolveAlias(symbol);
|
||||
|
||||
// It only makes sense to get the type of a value symbol. If the result of resolving
|
||||
// the alias is not a value, then it has no type. To get the type associated with a
|
||||
// type symbol, call getDeclaredTypeOfSymbol.
|
||||
// This check is important because without it, a call to getTypeOfSymbol could end
|
||||
// up recursively calling getTypeOfAlias, causing a stack overflow.
|
||||
links.type = targetSymbol.flags & SymbolFlags.Value
|
||||
? getTypeOfSymbol(targetSymbol)
|
||||
: unknownType;
|
||||
|
||||
Reference in New Issue
Block a user