@@ -121,19 +121,19 @@ namespace ts.codefix {
121
121
if ( declarations . length === 1 ) {
122
122
Debug . assert ( signatures . length === 1 , "One declaration implies one signature" ) ;
123
123
const signature = signatures [ 0 ] ;
124
- outputMethod ( signature , modifiers , name , ambient ? undefined : createStubbedMethodBody ( preferences ) ) ;
124
+ outputMethod ( preferences , signature , modifiers , name , ambient ? undefined : createStubbedMethodBody ( preferences ) ) ;
125
125
break ;
126
126
}
127
127
128
128
for ( const signature of signatures ) {
129
129
// 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 ( preferences , signature , getSynthesizedDeepClones ( modifiers , /*includeTrivia*/ false ) , getSynthesizedDeepClone ( name , /*includeTrivia*/ false ) ) ;
131
131
}
132
132
133
133
if ( ! ambient ) {
134
134
if ( declarations . length > signatures . length ) {
135
135
const signature = checker . getSignatureFromDeclaration ( declarations [ declarations . length - 1 ] as SignatureDeclaration ) ! ;
136
- outputMethod ( signature , modifiers , name , createStubbedMethodBody ( preferences ) ) ;
136
+ outputMethod ( preferences , signature , modifiers , name , createStubbedMethodBody ( preferences ) ) ;
137
137
}
138
138
else {
139
139
Debug . assert ( declarations . length === signatures . length , "Declarations and signatures should match count" ) ;
@@ -143,14 +143,15 @@ namespace ts.codefix {
143
143
break ;
144
144
}
145
145
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 ( preferences : UserPreferences , signature : Signature , modifiers : NodeArray < Modifier > | undefined , name : PropertyName , body ?: Block ) : void {
147
+ const method = signatureToMethodDeclaration ( context , preferences , signature , enclosingDeclaration , modifiers , name , optional , body , importAdder ) ;
148
148
if ( method ) addClassElement ( method ) ;
149
149
}
150
150
}
151
151
152
152
function signatureToMethodDeclaration (
153
153
context : TypeConstructionContext ,
154
+ preferences : UserPreferences ,
154
155
signature : Signature ,
155
156
enclosingDeclaration : ClassLikeDeclaration ,
156
157
modifiers : NodeArray < Modifier > | undefined ,
@@ -162,7 +163,8 @@ namespace ts.codefix {
162
163
const program = context . program ;
163
164
const checker = program . getTypeChecker ( ) ;
164
165
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 ) ) ;
166
168
if ( ! signatureDeclaration ) {
167
169
return undefined ;
168
170
}
0 commit comments