Ajax API - cart/change.js Endpoint - Wrong Documentation?

Hello,

thanks for th answer. But this does not make sense to me. First of all: Why can i pass the quantity as a “number” ?

Secondly: For adding an item i use the exact same Pattern:

export const addItem = async (variantID, quantity) => {

    let formData = {
        'items': [{
            'id': variantID,
            'quantity': 1
        }]
    }

    let cartContents = fetch('/cart/add.js', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(formData)
    })
    .then(response => {
        return response.json();
    })
    .catch((error) => {
        console.error('Error:', error);
    })

    return cartContents
}

But here i can pass the variantID as a “number”. I really tested this multiple times. I read many forum posts of people having trouble with this. At the end all works as expected BUT i need to pass the variant ID as a String ONLY at /cart/change.js

If you have any more questions please let me know.