@@ -1570,7 +1570,7 @@ namespace ts {
1570
1570
else {
1571
1571
let pattern : Pattern | undefined ;
1572
1572
if ( node . name . kind === SyntaxKind . StringLiteral ) {
1573
- const text = ( < StringLiteral > node . name ) . text ;
1573
+ const { text } = node . name ;
1574
1574
if ( hasZeroOrOneAsteriskCharacter ( text ) ) {
1575
1575
pattern = tryParsePattern ( text ) ;
1576
1576
}
@@ -1589,22 +1589,13 @@ namespace ts {
1589
1589
else {
1590
1590
const state = declareModuleSymbol ( node ) ;
1591
1591
if ( state !== ModuleInstanceState . NonInstantiated ) {
1592
- if ( node . symbol . flags & ( SymbolFlags . Function | SymbolFlags . Class | SymbolFlags . RegularEnum ) ) {
1593
- // if module was already merged with some function, class or non-const enum
1594
- // treat is a non-const-enum-only
1595
- node . symbol . constEnumOnlyModule = false ;
1596
- }
1597
- else {
1598
- const currentModuleIsConstEnumOnly = state === ModuleInstanceState . ConstEnumOnly ;
1599
- if ( node . symbol . constEnumOnlyModule === undefined ) {
1600
- // non-merged case - use the current state
1601
- node . symbol . constEnumOnlyModule = currentModuleIsConstEnumOnly ;
1602
- }
1603
- else {
1604
- // merged case: module is const enum only if all its pieces are non-instantiated or const enum
1605
- node . symbol . constEnumOnlyModule = node . symbol . constEnumOnlyModule && currentModuleIsConstEnumOnly ;
1606
- }
1607
- }
1592
+ const { symbol } = node ;
1593
+ // if module was already merged with some function, class or non-const enum, treat it as non-const-enum-only
1594
+ symbol . constEnumOnlyModule = ( ! ( symbol . flags & ( SymbolFlags . Function | SymbolFlags . Class | SymbolFlags . RegularEnum ) ) )
1595
+ // Current must be `const enum` only
1596
+ && state === ModuleInstanceState . ConstEnumOnly
1597
+ // Can't have been set to 'false' in a previous merged symbol. ('undefined' OK)
1598
+ && symbol . constEnumOnlyModule !== false ;
1608
1599
}
1609
1600
}
1610
1601
}
0 commit comments