Add a comment in getTypeOfAlias

This commit is contained in:
Jason Freeman
2015-05-14 13:20:09 -07:00
parent 8922a09039
commit 26f73d4dc8

View File

@@ -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;