We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a28c703 commit 2344a80Copy full SHA for 2344a80
src/compiler/checker.ts
@@ -3117,7 +3117,8 @@ namespace ts {
3117
// pattern. Otherwise, it is the type any.
3118
function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean, reportErrors?: boolean): Type {
3119
if (element.initializer) {
3120
- return getBaseTypeOfLiteralType(checkExpressionCached(element.initializer));
+ const exprType = checkExpressionCached(element.initializer);
3121
+ return getCombinedNodeFlags(element) & NodeFlags.Const ? exprType : getBaseTypeOfLiteralType(exprType);
3122
}
3123
if (isBindingPattern(element.name)) {
3124
return getTypeFromBindingPattern(<BindingPattern>element.name, includePatternInType, reportErrors);
0 commit comments