diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ab4f961e3a0..3517f407f87 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3167,8 +3167,7 @@ namespace ts { /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration: BindingElement): Type { const pattern = declaration.parent; - let parentType = getTypeForBindingElementParent(pattern.parent); - + const parentType = getTypeForBindingElementParent(pattern.parent); // If parent has the unknown (error) type, then so does this binding element if (parentType === unknownType) { return unknownType; diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 95a56b12dd3..de8be5a27e8 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -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; }