Compactness type properties for operators acting in Banach function spaces are not always preserved when the operator is extended to a bigger space. Moreover, it is known that there exists a maximal (weakly) compact linear extension of a (weakly) compact operator if and only if its maximal continuous linear extension to its optimal domain is (weakly) compact. We show that the same happens if we consider AM-compactness for the operator, and we give some partial results regarding Dunford–Pettis operators. Narrow operators—considered as a family defined by a weak compactness type property—are also analyzed from this point of view. Finally, we provide some applications of the fact that an operator from a Banach function space extends to a narro...