@@ -285,10 +285,29 @@ namespace ts.codefix {
285285 : checker . typeToTypeNode ( contextualType , contextNode , /*flags*/ undefined , tracker ) ;
286286
287287 if ( kind === SyntaxKind . MethodDeclaration ) {
288- const body = isInterfaceDeclaration ( contextNode ) ? undefined : createStubbedMethodBody ( quotePreference ) ;
289- return factory . createMethodDeclaration ( /*decorators*/ undefined , modifiers , asteriskToken , name , /*questionToken*/ undefined , typeParameters , parameters , type , body ) as T ;
288+ return factory . createMethodDeclaration (
289+ /*decorators*/ undefined ,
290+ modifiers ,
291+ asteriskToken ,
292+ name ,
293+ /*questionToken*/ undefined ,
294+ typeParameters ,
295+ parameters ,
296+ type ,
297+ isInterfaceDeclaration ( contextNode ) ? undefined : createStubbedMethodBody ( quotePreference )
298+ ) as T ;
290299 }
291- return factory . createFunctionDeclaration ( /*decorators*/ undefined , modifiers , asteriskToken , name , typeParameters , parameters , type , createStubbedBody ( "Function not implemented." , quotePreference ) ) as T ;
300+
301+ return factory . createFunctionDeclaration (
302+ /*decorators*/ undefined ,
303+ modifiers ,
304+ asteriskToken ,
305+ name ,
306+ typeParameters ,
307+ parameters ,
308+ type ,
309+ createStubbedBody ( Diagnostics . Function_not_implemented . message , quotePreference )
310+ ) as T ;
292311 }
293312
294313 export function typeToAutoImportableTypeNode ( checker : TypeChecker , importAdder : ImportAdder , type : Type , contextNode : Node | undefined , scriptTarget : ScriptTarget , flags ?: NodeBuilderFlags , tracker ?: SymbolTracker ) : TypeNode | undefined {
@@ -392,7 +411,7 @@ namespace ts.codefix {
392411 }
393412
394413 function createStubbedMethodBody ( quotePreference : QuotePreference ) {
395- return createStubbedBody ( "Method not implemented." , quotePreference ) ;
414+ return createStubbedBody ( Diagnostics . Method_not_implemented . message , quotePreference ) ;
396415 }
397416
398417 export function createStubbedBody ( text : string , quotePreference : QuotePreference ) : Block {
0 commit comments