@@ -103,8 +103,7 @@ import {
103103 isExpandoPropertyDeclaration ,
104104 isExportAssignment ,
105105 isExportDeclaration ,
106- isExpressionWithTypeArguments ,
107- isExpression ,
106+ isExpressionWithTypeArguments ,
108107 isExternalModule ,
109108 isExternalModuleAugmentation ,
110109 isExternalModuleIndicator ,
@@ -129,9 +128,8 @@ import {
129128 isObjectLiteralExpression ,
130129 isOmittedExpression ,
131130 isParameter ,
132- isPrimitiveLiteralValue ,
133- isPrivateIdentifier ,
134- isPropertyAccessExpression ,
131+ isPrimitiveLiteralValue ,
132+ isPrivateIdentifier ,
135133 isSemicolonClassElement ,
136134 isSetAccessorDeclaration ,
137135 isSourceFile ,
@@ -202,8 +200,8 @@ import {
202200 TransformationContext ,
203201 Transformer ,
204202 transformNodes ,
205- tryCast ,
206- TypeAliasDeclaration ,
203+ tryCast ,
204+ TypeAliasDeclaration ,
207205 TypeNode ,
208206 TypeParameterDeclaration ,
209207 TypeReferenceNode ,
@@ -656,21 +654,21 @@ export function transformDeclarations(context: TransformationContext): Transform
656654 return newParam ;
657655 }
658656
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
663661 }
664662
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 ;
674672 }
675673 function ensureType ( node : VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertySignature | ExportAssignment | SignatureDeclaration , ignorePrivate ?: boolean ) : TypeNode | undefined {
676674 if ( ! ignorePrivate && hasEffectiveModifier ( node , ModifierFlags . Private ) ) {
@@ -1051,12 +1049,12 @@ export function transformDeclarations(context: TransformationContext): Transform
10511049 const oldWithinObjectLiteralType = suppressNewDiagnosticContexts ;
10521050 let shouldEnterSuppressNewDiagnosticsContextContext = ( input . kind === SyntaxKind . TypeLiteral || input . kind === SyntaxKind . MappedType ) && input . parent . kind !== SyntaxKind . TypeAliasDeclaration ;
10531051
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+ }
10601058 }
10611059
10621060 if ( canProduceDiagnostic && ! suppressNewDiagnosticContexts ) {
0 commit comments