'How to tell typescript that an array is not empty in a map method?

I'm using the && operator in react to map an array if that array is not empty. However, later when it is mapping I'm trying to access the current element's id, and it's giving me the following error because it thinks that the array can be empty, even if I'm running a check before the map to make sure that it is not empty:

Property 'id' does not exist on type 'array'. Property 'id' does not exist on type '[]'.ts(23

This is my code

const RenderArray = () => (<div>{(Array.isArray(array) &&
        array.length) &&
        array.map((item, idx) => {
            const currentItem = anotherArray.find(
                (data) => data.id == item.id
            )
            return <div></div>
        })}
</div>

)

the first array has the following types:

type array = [] | {
id: string;
name?: string | undefined;
quantity: number; }

EDIT: the second array has these types:

const anotherArray: {
id: string;
name: string; }[]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source