@@ -103,8 +103,7 @@ import {
103
103
isExpandoPropertyDeclaration ,
104
104
isExportAssignment ,
105
105
isExportDeclaration ,
106
- isExpressionWithTypeArguments ,
107
- isExpression ,
106
+ isExpressionWithTypeArguments ,
108
107
isExternalModule ,
109
108
isExternalModuleAugmentation ,
110
109
isExternalModuleIndicator ,
@@ -129,9 +128,8 @@ import {
129
128
isObjectLiteralExpression ,
130
129
isOmittedExpression ,
131
130
isParameter ,
132
- isPrimitiveLiteralValue ,
133
- isPrivateIdentifier ,
134
- isPropertyAccessExpression ,
131
+ isPrimitiveLiteralValue ,
132
+ isPrivateIdentifier ,
135
133
isSemicolonClassElement ,
136
134
isSetAccessorDeclaration ,
137
135
isSourceFile ,
@@ -202,8 +200,8 @@ import {
202
200
TransformationContext ,
203
201
Transformer ,
204
202
transformNodes ,
205
- tryCast ,
206
- TypeAliasDeclaration ,
203
+ tryCast ,
204
+ TypeAliasDeclaration ,
207
205
TypeNode ,
208
206
TypeParameterDeclaration ,
209
207
TypeReferenceNode ,
@@ -656,21 +654,21 @@ export function transformDeclarations(context: TransformationContext): Transform
656
654
return newParam ;
657
655
}
658
656
659
- function shouldPrintWithInitializer ( node : Node ) : node is CanHaveLiteralInitializer & { initializer : Expression ; } {
660
- return canHaveLiteralInitializer ( node )
661
- && ! ! node . initializer
662
- && resolver . isLiteralConstDeclaration ( getParseTreeNode ( node ) as CanHaveLiteralInitializer ) ; // TODO: Make safea
657
+ function shouldPrintWithInitializer ( node : Node ) : node is CanHaveLiteralInitializer & { initializer : Expression ; } {
658
+ return canHaveLiteralInitializer ( node )
659
+ && ! ! node . initializer
660
+ && resolver . isLiteralConstDeclaration ( getParseTreeNode ( node ) as CanHaveLiteralInitializer ) ; // TODO: Make safea
663
661
}
664
662
665
- function ensureNoInitializer ( node : CanHaveLiteralInitializer ) {
666
- if ( shouldPrintWithInitializer ( node ) ) {
667
- const unwrappedInitializer = unwrapParenthesizedExpression ( node . initializer ) ;
668
- if ( ! isPrimitiveLiteralValue ( unwrappedInitializer ) ) {
669
- reportInferenceFallback ( node ) ;
670
- }
671
- return resolver . createLiteralConstValue ( getParseTreeNode ( node , canHaveLiteralInitializer ) ! , symbolTracker ) ;
672
- }
673
- return undefined ;
663
+ function ensureNoInitializer ( node : CanHaveLiteralInitializer ) {
664
+ if ( shouldPrintWithInitializer ( node ) ) {
665
+ const unwrappedInitializer = unwrapParenthesizedExpression ( node . initializer ) ;
666
+ if ( ! isPrimitiveLiteralValue ( unwrappedInitializer ) ) {
667
+ reportInferenceFallback ( node ) ;
668
+ }
669
+ return resolver . createLiteralConstValue ( getParseTreeNode ( node , canHaveLiteralInitializer ) ! , symbolTracker ) ;
670
+ }
671
+ return undefined ;
674
672
}
675
673
function ensureType ( node : VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertySignature | ExportAssignment | SignatureDeclaration , ignorePrivate ?: boolean ) : TypeNode | undefined {
676
674
if ( ! ignorePrivate && hasEffectiveModifier ( node , ModifierFlags . Private ) ) {
@@ -1051,12 +1049,12 @@ export function transformDeclarations(context: TransformationContext): Transform
1051
1049
const oldWithinObjectLiteralType = suppressNewDiagnosticContexts ;
1052
1050
let shouldEnterSuppressNewDiagnosticsContextContext = ( input . kind === SyntaxKind . TypeLiteral || input . kind === SyntaxKind . MappedType ) && input . parent . kind !== SyntaxKind . TypeAliasDeclaration ;
1053
1051
1054
- // Emit methods which are private as properties with no type information
1055
- if ( isMethodDeclaration ( input ) || isMethodSignature ( input ) ) {
1056
- if ( hasEffectiveModifier ( input , ModifierFlags . Private ) ) {
1057
- if ( input . symbol && input . symbol . declarations && input . symbol . declarations [ 0 ] !== input ) return ; // Elide all but the first overload
1058
- return cleanup ( factory . createPropertyDeclaration ( ensureModifiers ( input ) , input . name , /*questionOrExclamationToken*/ undefined , /*type*/ undefined , /*initializer*/ undefined ) ) ;
1059
- }
1052
+ // Emit methods which are private as properties with no type information
1053
+ if ( isMethodDeclaration ( input ) || isMethodSignature ( input ) ) {
1054
+ if ( hasEffectiveModifier ( input , ModifierFlags . Private ) ) {
1055
+ if ( input . symbol && input . symbol . declarations && input . symbol . declarations [ 0 ] !== input ) return ; // Elide all but the first overload
1056
+ return cleanup ( factory . createPropertyDeclaration ( ensureModifiers ( input ) , input . name , /*questionOrExclamationToken*/ undefined , /*type*/ undefined , /*initializer*/ undefined ) ) ;
1057
+ }
1060
1058
}
1061
1059
1062
1060
if ( canProduceDiagnostic && ! suppressNewDiagnosticContexts ) {
0 commit comments