@@ -121,19 +121,19 @@ namespace ts.codefix {
121121 if ( declarations . length === 1 ) {
122122 Debug . assert ( signatures . length === 1 , "One declaration implies one signature" ) ;
123123 const signature = signatures [ 0 ] ;
124- outputMethod ( signature , modifiers , name , ambient ? undefined : createStubbedMethodBody ( preferences ) ) ;
124+ outputMethod ( signature , modifiers , name , preferences , ambient ? undefined : createStubbedMethodBody ( preferences ) ) ;
125125 break ;
126126 }
127127
128128 for ( const signature of signatures ) {
129129 // Need to ensure nodes are fresh each time so they can have different positions.
130- outputMethod ( signature , getSynthesizedDeepClones ( modifiers , /*includeTrivia*/ false ) , getSynthesizedDeepClone ( name , /*includeTrivia*/ false ) ) ;
130+ outputMethod ( signature , getSynthesizedDeepClones ( modifiers , /*includeTrivia*/ false ) , getSynthesizedDeepClone ( name , /*includeTrivia*/ false ) , preferences ) ;
131131 }
132132
133133 if ( ! ambient ) {
134134 if ( declarations . length > signatures . length ) {
135135 const signature = checker . getSignatureFromDeclaration ( declarations [ declarations . length - 1 ] as SignatureDeclaration ) ! ;
136- outputMethod ( signature , modifiers , name , createStubbedMethodBody ( preferences ) ) ;
136+ outputMethod ( signature , modifiers , name , preferences , createStubbedMethodBody ( preferences ) ) ;
137137 }
138138 else {
139139 Debug . assert ( declarations . length === signatures . length , "Declarations and signatures should match count" ) ;
@@ -143,14 +143,15 @@ namespace ts.codefix {
143143 break ;
144144 }
145145
146- function outputMethod ( signature : Signature , modifiers : NodeArray < Modifier > | undefined , name : PropertyName , body ?: Block ) : void {
147- const method = signatureToMethodDeclaration ( context , signature , enclosingDeclaration , modifiers , name , optional , body , importAdder ) ;
146+ function outputMethod ( signature : Signature , modifiers : NodeArray < Modifier > | undefined , name : PropertyName , preferences : UserPreferences , body ?: Block ) : void {
147+ const method = signatureToMethodDeclaration ( context , preferences , signature , enclosingDeclaration , modifiers , name , optional , body , importAdder ) ;
148148 if ( method ) addClassElement ( method ) ;
149149 }
150150 }
151151
152152 function signatureToMethodDeclaration (
153153 context : TypeConstructionContext ,
154+ preferences : UserPreferences ,
154155 signature : Signature ,
155156 enclosingDeclaration : ClassLikeDeclaration ,
156157 modifiers : NodeArray < Modifier > | undefined ,
@@ -162,7 +163,8 @@ namespace ts.codefix {
162163 const program = context . program ;
163164 const checker = program . getTypeChecker ( ) ;
164165 const scriptTarget = getEmitScriptTarget ( program . getCompilerOptions ( ) ) ;
165- const signatureDeclaration = < MethodDeclaration > checker . signatureToSignatureDeclaration ( signature , SyntaxKind . MethodDeclaration , enclosingDeclaration , NodeBuilderFlags . NoTruncation | NodeBuilderFlags . SuppressAnyReturnType , getNoopSymbolTrackerWithResolver ( context ) ) ;
166+ const flags = NodeBuilderFlags . NoTruncation | NodeBuilderFlags . SuppressAnyReturnType | ( preferences . quotePreference === "single" ? NodeBuilderFlags . UseSingleQuotesForStringLiteralType : 0 ) ;
167+ const signatureDeclaration = < MethodDeclaration > checker . signatureToSignatureDeclaration ( signature , SyntaxKind . MethodDeclaration , enclosingDeclaration , flags , getNoopSymbolTrackerWithResolver ( context ) ) ;
166168 if ( ! signatureDeclaration ) {
167169 return undefined ;
168170 }
0 commit comments