Discord.JS V13 – Slash Command Options “TypeError: command.options?.map is not a function”

I made a support for options in slash command in Discord.JS. But it gets TypeError continuously.

And if i delete options and option property from the script, it just ignores choices and returns a command like form of this:

Image

command.json’s fragment that causes error:
(Only option causes this error. Other type won’t cause error.)

{
    "commands": [
       {
            "GuildId": "global",
            "data": {
                "name": "Loop",
                "type": 1,
                "description": "Setup loop mode.",
                "options":{
                    "option":[
                "choices": {
                    {
                        "name": "Off",
                        "value": "QueueRepeatMode.OFF"
                    },
                    {
                        "name": "Play One Song",
                        "value": "QueueRepeatMode.TRACK"
                    },
                    {
                        "name": "Every Queue",
                        "value": "QueueRepeatMode.QUEUE"
                    },
                    {
                        "name": "Autoplay",
                        "value": "QueueRepeatMode.AUTOPLAY"
                    }
                    }
                ]
                },
                "defaultPermission": true
            }
        }
]
}

index.js :


    const token = "MY_TOKEN";
    const { Client } = require('discord.js');
    
    const client = new Client({ intents: parseInt("10111111111111111", 2) });
    
    client.login(token).then(async () => {
        for (data of await client.application?.commands.fetch()) {
            await client.application?.commands.delete(data[0]);
        }
        console.log('[ℹ️ INFO] Remaining CMD is deleting');
        const { commands } = require('./commands.json');
        for (command of commands) {
            console.log('[ℹ️ INFO] Slash CMD is registering: ',command.data.name);
            let AppCommand = null;
            if (command.GuildId == 'global')
                AppCommand = await client.application?.commands.create(command.data);
            else AppCommand = await client.application?.commands.create(command.data, command.GuildId);
            if ('permissions' in command) {
                const permissions = command.permissions;
                await AppCommand.permissions.add({ permissions });
            }
        }
        console.log('[ℹ️ INFO] Slash CMD was registered.');
    });

Error:

/workspaces/askk6-discord/node_modules/discord.js/src/managers/ApplicationCommandManager.js:211
      options: command.options?.map(o => ApplicationCommand.transformOption(o)),
                                ^

TypeError: command.options?.map is not a function
    at Function.transformCommand (/workspaces/askk6-discord/node_modules/discord.js/src/managers/ApplicationCommandManager.js:211:33)
    at ApplicationCommandManager.create (/workspaces/askk6-discord/node_modules/discord.js/src/managers/ApplicationCommandManager.js:118:30)
    at /workspaces/askk6-discord/manual-register.js:18:65
    at processTicksAndRejections (node:internal/process/task_queues:96:5)