namespace ts . codefix { const errorCodes = [ Diagnostics . Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2 . code , Diagnostics . Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1 . code , ] ; const fixId = "fixClassDoesntImplementInheritedAbstractMember" ; registerCodeFix ( { errorCodes , getCodeActions : function getCodeActionsToFixClassNotImplementingInheritedMembers ( context ) { const { sourceFile , span } = context ; const changes = textChanges . ChangeTracker . with ( context , t => addMissingMembers ( getClass ( sourceFile , span . start ) , sourceFile , context , t , context . preferences ) ) ; return changes . length === 0 ? undefined : [ createCodeFixAction ( fixId , changes , Diagnostics . Implement_inherited_abstract_class , fixId , Diagnostics . Implement_all_inherited_abstract_classes ) ] ; } , fixIds : [ fixId ] , getAllCodeActions : function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember ( context ) { const seenClassDeclarations = new Map < number , true > ( ) ; return codeFixAll ( context , errorCodes , ( changes , diag ) => { const classDeclaration = getClass ( diag . file , diag . start ) ; if ( addToSeen ( seenClassDeclarations , getNodeId ( classDeclaration ) ) ) { addMissingMembers ( classDeclaration , context . sourceFile , context , changes , context . preferences ) ; } } ) ; } , } ) ; function getClass ( sourceFile , pos ) { const token = getTokenAtPosition ( sourceFile , pos ) ; return cast ( token . parent , isClassLike ) ; } function addMissingMembers ( classDeclaration , sourceFile , context , changeTracker , preferences ) { const extendsNode = getEffectiveBaseTypeNode ( classDeclaration ) ! ; const checker = context . program . getTypeChecker ( ) ; const instantiatedExtendsType = checker . getTypeAtLocation ( extendsNode ) ; const abstractAndNonPrivateExtendsSymbols = checker . getPropertiesOfType ( instantiatedExtendsType ) . filter ( symbolPointsToNonPrivateAndAbstractMember ) ; const importAdder = createImportAdder ( sourceFile , context . program , preferences , context . host ) ; createMissingMemberNodes ( classDeclaration , abstractAndNonPrivateExtendsSymbols , sourceFile , context , preferences , importAdder , member => changeTracker . insertNodeAtClassStart ( sourceFile , classDeclaration , member as ClassElement ) ) ; importAdder . writeFixes ( changeTracker ) ; } function symbolPointsToNonPrivateAndAbstractMember ( symbol ) { const flags = getSyntacticModifierFlags ( first ( symbol . getDeclarations ( ) ! ) ) ; return ! ( flags & ModifierFlags . Private ) && ! ! ( flags & ModifierFlags . Abstract ) ; } }