File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -541,7 +541,6 @@ import {
541541 isEnumLiteralExpression,
542542 isEnumMember,
543543 isEnumTypeAnnotation,
544- isEnumTypeReference,
545544 isExclusivelyTypeOnlyImportOrExport,
546545 isExpandoPropertyDeclaration,
547546 isExportAssignment,
@@ -16712,8 +16711,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1671216711 return links.resolvedType = checkExpressionCached(node.parent.expression);
1671316712 }
1671416713 // `var MyEnum: enum = { FirstValue: 1, SecondValue: 2 }` should resolve to a union of the enum values.
16715- if (isEnumTypeReference( node) && isVariableDeclaration(node .parent) && node.parent.initializer && isEnumLiteralExpression (node.parent.initializer )) {
16716- return links.resolvedType = checkExpressionCached(node.parent.initializer);
16714+ if (node.parent && isEnumLiteralDeclaration (node.parent)) {
16715+ return links.resolvedType = checkExpressionCached(( node.parent as VariableDeclaration) .initializer as Expression );
1671716716 }
1671816717 let symbol: Symbol | undefined;
1671916718 let type: Type | undefined;
@@ -44140,7 +44139,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4414044139 checkClassNameCollisionWithObject(name);
4414144140 }
4414244141 }
44143- else if (isEnumDeclaration(node) || (isVariableDeclaration( node) && node.initializer && isEnumLiteralExpression(node.initializer) )) {
44142+ else if (isEnumDeclaration(node) || isEnumLiteralDeclaration( node)) {
4414444143 checkTypeNameIsReserved(name, Diagnostics.Enum_name_cannot_be_0);
4414544144 }
4414644145 }
You can’t perform that action at this time.
0 commit comments