Address PR comments and fix lint

This commit is contained in:
Nathan Shively-Sanders
2017-02-13 13:21:12 -08:00
parent 6328e6cfe2
commit c2cd4f66e7
2 changed files with 3 additions and 6 deletions

View File

@@ -3167,8 +3167,7 @@ namespace ts {
/** Return the inferred type for a binding element */
function getTypeForBindingElement(declaration: BindingElement): Type {
const pattern = <BindingPattern>declaration.parent;
let parentType = getTypeForBindingElementParent(<VariableLikeDeclaration>pattern.parent);
const parentType = getTypeForBindingElementParent(<VariableLikeDeclaration>pattern.parent);
// If parent has the unknown (error) type, then so does this binding element
if (parentType === unknownType) {
return unknownType;

View File

@@ -333,10 +333,8 @@ namespace ts {
}
else {
errorNameNode = declaration.name;
let format = TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue;
if (shouldUseResolverType) {
format |= TypeFormatFlags.AddUndefined;
}
const format = TypeFormatFlags.UseTypeOfFunction | TypeFormatFlags.UseTypeAliasValue |
(shouldUseResolverType ? TypeFormatFlags.AddUndefined : 0);
resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, format, writer);
errorNameNode = undefined;
}