File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,6 @@ import {
541
541
isEnumLiteralExpression,
542
542
isEnumMember,
543
543
isEnumTypeAnnotation,
544
- isEnumTypeReference,
545
544
isExclusivelyTypeOnlyImportOrExport,
546
545
isExpandoPropertyDeclaration,
547
546
isExportAssignment,
@@ -16712,8 +16711,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
16712
16711
return links.resolvedType = checkExpressionCached(node.parent.expression);
16713
16712
}
16714
16713
// `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 );
16717
16716
}
16718
16717
let symbol: Symbol | undefined;
16719
16718
let type: Type | undefined;
@@ -44140,7 +44139,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
44140
44139
checkClassNameCollisionWithObject(name);
44141
44140
}
44142
44141
}
44143
- else if (isEnumDeclaration(node) || (isVariableDeclaration( node) && node.initializer && isEnumLiteralExpression(node.initializer) )) {
44142
+ else if (isEnumDeclaration(node) || isEnumLiteralDeclaration( node)) {
44144
44143
checkTypeNameIsReserved(name, Diagnostics.Enum_name_cannot_be_0);
44145
44144
}
44146
44145
}
You can’t perform that action at this time.
0 commit comments