Workaround to match previous type writer output
This commit is contained in:
parent
186f52572b
commit
e305de1403
2 changed files with 10 additions and 5 deletions
|
@ -12002,10 +12002,6 @@ module ts {
|
|||
return unknownType;
|
||||
}
|
||||
|
||||
if (isClassExtendsExpressionWithTypeArguments(node)) {
|
||||
return getBaseTypes(<InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
|
||||
}
|
||||
|
||||
if (isTypeNode(node)) {
|
||||
return getTypeFromTypeNode(<TypeNode>node);
|
||||
}
|
||||
|
@ -12014,6 +12010,12 @@ module ts {
|
|||
return getTypeOfExpression(<Expression>node);
|
||||
}
|
||||
|
||||
if (isClassExtendsExpressionWithTypeArguments(node)) {
|
||||
// A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the
|
||||
// extends clause of a class. We handle that case here.
|
||||
return getBaseTypes(<InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0];
|
||||
}
|
||||
|
||||
if (isTypeDeclaration(node)) {
|
||||
// In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration
|
||||
let symbol = getSymbolOfNode(node);
|
||||
|
|
|
@ -41,7 +41,10 @@ class TypeWriterWalker {
|
|||
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos);
|
||||
var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
|
||||
|
||||
var type = this.checker.getTypeAtLocation(node);
|
||||
// Workaround to ensure we output 'C' instead of 'typeof C' for base class expressions
|
||||
// var type = this.checker.getTypeAtLocation(node);
|
||||
var type = node.parent && ts.isClassExtendsExpressionWithTypeArguments(node.parent) && this.checker.getTypeAtLocation(node.parent) || this.checker.getTypeAtLocation(node);
|
||||
|
||||
ts.Debug.assert(type !== undefined, "type doesn't exist");
|
||||
var symbol = this.checker.getSymbolAtLocation(node);
|
||||
|
||||
|
|
Loading…
Reference in a new issue