Typescript cannot infer types if you use Javascript in strapi

Hello everyone,

I am trying to implement a whatsapp bot along with a strapi backend.

To do this I had to generate an entity (whatsapp) in order to place the entry points required by META to verify the token and rebir messages in my bakend.

The token verification worked perfectly, but the second function that receives the message gives me problems by typescript, since it can not infer the types that come in the object that sends me whatsapp in the ctx.body of the request.

I tried several methods and none of them worked, does anyone have any idea of a possible solution?

'use strict';

/**
 * whatsapp controller
 */

const { getTextUser } = require('./utils/getTextUser');
const { createCoreController } = require('@strapi/strapi').factories;

const dotenv = require('dotenv');
dotenv.config();

const { processMessage } = require('./shared/processMessage');

module.exports = createCoreController('api::whatsapp.whatsapp', ({strapi}) => ({
    async verifyToken (ctx) {
        try {
            var accessToken = process.env.WHATSAPP_WEBHOOK_KEY;
            var token = ctx.request.query["hub.verify_token"];
            var challenge = ctx.request.query["hub.challenge"];
    
            console.log(ctx.request);
            console.log('------------------------------');

            console.log(accessToken);
            console.log('------------------------------');

            console.log(challenge);
            console.log('------------------------------');

            console.log(token);
            console.log('------------------------------');

    
            if (challenge != null && token != null && token == accessToken) {
                ctx.body = challenge;
            } else {
                ctx.status = 400;
            }
        } catch (error) {
            ctx.status = 400;
        }
    },
    async recivedMessage (ctx) {
        try {

            var entry = (ctx.body.entry[0];
            var changes = entry.changes.[0];
            var value = changes.value;
            var messageObject = value.messages;
        
            if(typeof messageObject != 'undefined'){

                var messages = messageObject[0];
                var number = messages.from; 
                var text = getTextUser(messages); 
    
                await processMessage(text, number);
                  
             }

             console.log('Good');
            ctx.response.body = 'EVENT_RECEIVED';
        } catch (error) {
            console.log('Bad');
            ctx.response.body = 'EVENT_RECEIVED';;
        }
    }
    
}));