‘Property ‘onReady’ does not exist on type ‘(selector: string) →> any’

I am creating a website on wix studio and this error shows up. The logic is

$w.onReady(function () {
    // Add click event handler for the register button
    $w('#registerButton').onClick(() => {
        const email = $w('#email').value;
        const password = $w('#password').value;

        // Validate inputs
        if (!email || !password) {
            $w('#errorMessage').text = "Please enter both email and password.";
            return;
        }
    })
})

I tried to add the code directly in the admin page code panel but it says that the onReady property does not exist on type '(selector: string).