typescript - Error Initializing 'discord-player' with Discord.js Client - Stack Overflow

admin2025-04-21  2

I do everything as shown in the documentation of discord-player but get following Error:

TS2345: Argument of type
import(".../ WebstormProjects/ DiscordBot/ node_modules/ discord. js/ typings/ index", {with: {"resolution-mode": "import"}}).Client<boolean> 

is not assignable to parameter of type

import(".../ WebstormProjects/ DiscordBot/ node_modules/ discord. js/ typings/ index").Client<boolean>

Types have separate declarations of a private property actions

The error occurres in the line: const player = new Player(client) It says that the passed client is not from the correct type.

The complete code is:

import {Client} from "discord.js";
import {ClientIntents, ClientPartials} from "../config/index.js";
import {Player} from "discord-player"

const client = new Client({
    intents: ClientIntents,
    partials: ClientPartials,
})

const player = new Player(client); // ? Why error???

I already check that i only have 1 discord.js version.

转载请注明原文地址:http://anycun.com/QandA/1745227673a90487.html