Skip to content

How to check if form shipping address in checkout is valid

When I do in checkout, I got an error :
I would like to detect if the person has filled in the registration form in the checkout, this code is added in this file : app/design/frontend/Theme/theme/Amasty_CheckoutCore/templates/onepage.phtml

define(['jquery','mage/translate', 'mage/validation'], function($){
    "use strict";
    return {
        customMain: function (){

            console.log($('.form-shipping-address').validation('isValid'))


        }
    }
});

error :

Uncaught Error: cannot call methods on validation prior to initialization; attempted to call method ‘isValid’