appujet / lavamusic

lavalink music bot base in lavalink-client and discord.js v14
https://appujet.github.io/lavamusic/
GNU General Public License v3.0
569 stars 495 forks source link

error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'. #584

Closed Pentagram5237 closed 3 months ago

Pentagram5237 commented 3 months ago

OS: Linux NodeJS version: v22.3.0

Steps: I just followed the install instructions

Result:

> lavamusic@4.3.3 start
> npm run build && node dist/index.js

> lavamusic@4.3.3 build
> tsc --project tsconfig.json

src/structures/Dispatcher.ts:81:53 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

81             .on("start", () => this.client.shoukaku.emit("trackStart", this.player, this.current, this))
                                                       ~~~~

src/structures/Dispatcher.ts:84:42 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

84                     this.client.shoukaku.emit("queueEnd", this.player, this.current, this);
                                            ~~~~

src/structures/Dispatcher.ts:86:38 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

86                 this.client.shoukaku.emit("trackEnd", this.player, this.current, this);
                                        ~~~~

src/structures/Dispatcher.ts:88:53 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

88             .on("stuck", () => this.client.shoukaku.emit("trackStuck", this.player, this.current))
                                                       ~~~~

src/structures/Dispatcher.ts:89:61 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

89             .on("closed", (...args) => this.client.shoukaku.emit("socketClosed", this.player, ...args));
                                                               ~~~~

src/structures/Dispatcher.ts:140:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

140             this.client.shoukaku.emit("playerDestroy", this.player);
                                     ~~~~

src/structures/Queue.ts:54:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

54             this.client.shoukaku.emit("playerCreate", dispatcher.player);
                                    ~~~~

src/structures/Shoukaku.ts:26:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

26             this.client.shoukaku.emit(reconnected ? "nodeReconnect" : "nodeConnect", name);
                                    ~~~~

src/structures/Shoukaku.ts:30:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

30             this.client.shoukaku.emit("nodeError", name, error);
                                    ~~~~

src/structures/Shoukaku.ts:34:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

34             this.client.shoukaku.emit("nodeDestroy", name, code, reason);
                                    ~~~~

src/structures/Shoukaku.ts:38:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

38             this.client.shoukaku.emit("nodeDisconnect", name, count);
                                    ~~~~

src/structures/Shoukaku.ts:42:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

42             this.client.shoukaku.emit("nodeRaw", name, reason);
                                    ~~~~

Found 12 errors in 3 files.

Errors  Files
     6  src/structures/Dispatcher.ts:81
     1  src/structures/Queue.ts:54
     5  src/structures/Shoukaku.ts:26
LucasB25 commented 3 months ago

npm update

Dectectable commented 3 months ago

The npm update Dosn't Work

hwangsihu commented 3 months ago

This problem needs to be corrected by Lucas. There is also a lint error in biome.

LucasB25 commented 3 months ago

this is a problem which was corrected under shoukaku you simply have to reinstall the npm

hwangsihu commented 3 months ago

hmmm its not work

hwangsihu commented 3 months ago

@Pentagram5237 https://github.com/microsoft/TypeScript/releases/download/v5.4.5/typescript-5.4.5.tgz

hwangsihu commented 3 months ago

Delete the typescript folder from the node modules folder, download and unzip this file, then rename the packages folder to typescript and copy it to the node modules folder. It should work fine this time.

LucasB25 commented 3 months ago

npm update and update code https://github.com/appujet/lavamusic/commit/2cc62efda08affb452d41337a0afd876c54a5e9d

hwangsihu commented 3 months ago

I updated my code to the latest, but I'm still experiencing this symptom. Are you functioning well?

hwangsihu commented 3 months ago

I used npm i and npm update

hwangsihu commented 3 months ago

src/structures/Dispatcher.ts:106:37 - error TS2322: Type '{ encoded: string; }' is not assignable to type 'string'.

106 this.player.playTrack({ track: { encoded: this.current.encoded } });


  node_modules/shoukaku/dist/index.d.ts:186:5                                                                           
    186     track: string;                                                                                              
The expected type comes from property 'track' which is declared here on type 'PlayOptions'                          
hwangsihu commented 3 months ago

This was tested on typescript 5.4.5. But when I test it on 5.5.2, I start getting this error again.

lavamusic@4.3.3 clean:no-log
node ./scripts/clean-no-log.js && npm run build
src/structures/Dispatcher.ts : 81 : 53

  • error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'. 81 .on("start", () => this.client.shoukaku.emit("trackStart", this.player, this.current, this))


> lavamusic@4.3.3 build                                                                                                 
> tsc --project tsconfig.json                                                                                           

src/structures/Dispatcher.ts:81:53 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.             

81             .on("start", () => this.client.shoukaku.emit("trackStart", this.player, this.current, this))             

src/structures/Dispatcher.ts:84:42 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

84 this.client.shoukaku.emit("queueEnd", this.player, this.current, this);


src/structures/Dispatcher.ts:86:38 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.             

86                 this.client.shoukaku.emit("trackEnd", this.player, this.current, this);                              

src/structures/Dispatcher.ts:88:53 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

88 .on("stuck", () => this.client.shoukaku.emit("trackStuck", this.player, this.current))


src/structures/Dispatcher.ts:89:61 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.             

89             .on("closed", (...args) => this.client.shoukaku.emit("socketClosed", this.player, ...args));             

src/structures/Dispatcher.ts:106:37 - error TS2322: Type '{ encoded: string; }' is not assignable to type 'string'.

106 this.player.playTrack({ track: { encoded: this.current.encoded } });


  node_modules/shoukaku/dist/index.d.ts:186:5                                                                           
    186     track: string;                                                                                              
The expected type comes from property 'track' which is declared here on type 'PlayOptions'                          

src/structures/Dispatcher.ts:140:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

140 this.client.shoukaku.emit("playerDestroy", this.player);


src/structures/Queue.ts:54:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.                  

54             this.client.shoukaku.emit("playerCreate", dispatcher.player);                                            

src/structures/Shoukaku.ts:26:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

26 this.client.shoukaku.emit(reconnected ? "nodeReconnect" : "nodeConnect", name);


src/structures/Shoukaku.ts:30:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.               

30             this.client.shoukaku.emit("nodeError", name, error);                                                     

src/structures/Shoukaku.ts:34:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

34 this.client.shoukaku.emit("nodeDestroy", name, code, reason);


src/structures/Shoukaku.ts:38:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.               

38             this.client.shoukaku.emit("nodeDisconnect", name, count);                                                

src/structures/Shoukaku.ts:42:34 - error TS2339: Property 'emit' does not exist on type 'ShoukakuClient'.

42 this.client.shoukaku.emit("nodeRaw", name, reason);



Found 13 errors in 3 files.                                                                                             

Errors  Files                                                                                                           
     7  src/structures/Dispatcher.ts:81                                                                                 
     1  src/structures/Queue.ts:54                                                                                      
     5  src/structures/Shoukaku.ts:26                                                                                   
LucasB25 commented 3 months ago

J'ai mis à jour mon code au plus tard, mais je rencontre toujours ce symptôme. Fonctionnez-vous bien ?

delete "node_modules" and "package-lock.json" + npm i

hwangsihu commented 3 months ago

aaaaaa still not work

LucasB25 commented 3 months ago

https://github.com/appujet/lavamusic/commit/1ce3712e97a922de3f2204a640097eaa65fc22b9

5wi5wi commented 3 months ago

1ce3712

i did npm i and started the bot and this is the output:

src/structures/Dispatcher.ts:106:37 - error TS2559: Type 'string' has no properties in common with type 'UpdatePlayerTrackOptions'.

106             this.player.playTrack({ track: this.current.encoded });
                                        ~~~~~

  node_modules/shoukaku/dist/index.d.ts:597:5
    597     track?: UpdatePlayerTrackOptions;
            ~~~~~
    The expected type comes from property 'track' which is declared here on type 'PlayOptions'

Found 1 error in src/structures/Dispatcher.ts:106
infnibor commented 3 months ago

1ce3712

i did npm i and started the bot and this is the output:

src/structures/Dispatcher.ts:106:37 - error TS2559: Type 'string' has no properties in common with type 'UpdatePlayerTrackOptions'.

106             this.player.playTrack({ track: this.current.encoded });
                                        ~~~~~

  node_modules/shoukaku/dist/index.d.ts:597:5
    597     track?: UpdatePlayerTrackOptions;
            ~~~~~
    The expected type comes from property 'track' which is declared here on type 'PlayOptions'

Found 1 error in src/structures/Dispatcher.ts:106

Update your code to latest version

5wi5wi commented 3 months ago

Update your code to latest version

im at the latest 4.3.3

infnibor commented 3 months ago

Update your code to latest version

im at the latest 4.3.3

Nope, latest is 4.5.0

infnibor commented 3 months ago

It's just not pushed as a new release in github yet, so it just downloads the latest code from the main branch

5wi5wi commented 3 months ago

It's just not pushed as a new release in github yet, so it just downloads the latest code from the main branch

it worked