Repository: numpy/numpy
File: numpy/ma/core.pyi (Python)

Code before:
        axis: None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: Literal[False] | _NoValueType = ...,
    ) -> intp: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: _ShapeLike | None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: bool | _NoValueType = ...,
    ) -> Any: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: _ShapeLike | None = None,
        fill_value: _ScalarLike_co | None = None,
        *,
        out: _ArrayType,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayType: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: _ScalarLike_co | None,
        fill_value: _ScalarLike_co | None,
        out: _ArrayType,
        *,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayType: ...
    @overload
    def argmax(  # type: ignore[override]
        self,
        axis: None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: Literal[False] | _NoValueType = ...,
    ) -> intp: ...
    @overload
    def argmax(  # type: ignore[override]
        self,
        axis: _ShapeLike | None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: bool | _NoValueType = ...,
    ) -> Any: ...

Review comment (suggestion):
After experimenting a bit with this, I noticed that safe casting rules apply to the `out` dtype. In practice that means that the scalar-type of `out` can only be `np.bool` or `np.integer`. You could consider using this fact to narrow the type that `out` accepts. It's already technically correct right now, so I consider it an optional improvement.

Code after:
    def argmin(  # type: ignore[override]
        self,
        axis: None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: Literal[False] | _NoValueType = ...,
    ) -> intp: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: SupportsIndex | None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: bool | _NoValueType = ...,
    ) -> Any: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: SupportsIndex | None = None,
        fill_value: _ScalarLike_co | None = None,
        *,
        out: _ArrayType,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayType: ...
    @overload
    def argmin(  # type: ignore[override]
        self,
        axis: SupportsIndex | None,
        fill_value: _ScalarLike_co | None,
        out: _ArrayType,
        *,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayType: ...

    # Keep in-sync with np.ma.argmax
    @overload
    def argmax(  # type: ignore[override]
        self,
        axis: None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: Literal[False] | _NoValueType = ...,
    ) -> intp: ...
    @overload
    def argmax(  # type: ignore[override]
        self,
        axis: SupportsIndex | None = None,
        fill_value: _ScalarLike_co | None = None,