discordx-ts / discordx

🤖 Create a discord bot with TypeScript and Decorators!
https://discordx.js.org
Apache License 2.0
615 stars 50 forks source link

[Bug]: discord.js 14.15.1 is not compatible with pagination #1014

Closed ShoGinn closed 4 months ago

ShoGinn commented 5 months ago

What happened?

Pagination has issues with the new changes to BaseMessage

See: https://github.com/discordjs/discord.js/pull/10045

Reproduction

Update the code and run npm run test

Package

@discordx/pagination

Version

Stable

Relevant log output

@discordx/pagination:build: src/Pagination.ts(139,34): error TS2339: Property 'push' does not exist on type 'readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>)[]'.
@discordx/pagination:build: src/Pagination.ts(269,40): error TS2339: Property 'push' does not exist on type 'readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>)[]'.
@discordx/pagination:build: src/Pagination.ts(311,40): error TS2339: Property 'push' does not exist on type 'readonly (APIActionRowComponent<APIMessageActionRowComponent> | JSONEncodable<APIActionRowComponent<APIMessageActionRowComponent>> | ActionRowData<...>)[]'.
@discordx/pagination:build: 
@discordx/pagination:build: Error: error occured in dts build
@discordx/pagination:build:     at Worker.<anonymous> (/discordx/node_modules/tsup/dist/index.js:2693:26)
@discordx/pagination:build:     at Worker.emit (node:events:520:28)
@discordx/pagination:build:     at MessagePort.<anonymous> (node:internal/worker:263:53)
@discordx/pagination:build:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:822:20)
@discordx/pagination:build:     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
@discordx/pagination:build: DTS Build error
@discordx/pagination:build: RollupError: [plugin dts] src/Pagination.ts: Failed to compile. Check the logs above.
@discordx/pagination:build:     at getRollupError (/discordx/node_modules/rollup/dist/shared/parseAst.js:282:41)
@discordx/pagination:build:     at Object.error (/discordx/node_modules/rollup/dist/shared/parseAst.js:278:42)
@discordx/pagination:build:     at Object.error (/discordx/node_modules/rollup/dist/shared/rollup.js:813:32)
@discordx/pagination:build:     at Object.error (/discordx/node_modules/rollup/dist/shared/rollup.js:19565:42)
@discordx/pagination:build:     at generateDtsFromTs (/discordx/node_modules/tsup/dist/rollup.js:7776:22)
@discordx/pagination:build:     at /discordx/node_modules/tsup/dist/rollup.js:7783:59
@discordx/pagination:build:     at _nullishCoalesce (/discordx/node_modules/tsup/dist/rollup.js:1:198)
@discordx/pagination:build:     at Object.transform (/discordx/node_modules/tsup/dist/rollup.js:7783:18)
@discordx/pagination:build:     at /discordx/node_modules/rollup/dist/shared/rollup.js:998:40
@discordx/pagination:build: npm ERR! Lifecycle script `build` failed with error: 
@discordx/pagination:build: npm ERR! Error: command failed 
@discordx/pagination:build: npm ERR!   in workspace: @discordx/pagination@3.5.0 
@discordx/pagination:build: npm ERR!   at location: /discordx/packages/pagination 
@discordx/pagination:build: 
@discordx/pagination:build: ERROR: command finished with error: command (/discordx/packages/pagination) /opt/homebrew/bin/npm run build exited (1)
@discordx/pagination#build: command (/discordx/packages/pagination) /opt/homebrew/bin/npm run build exited (1)

Code of Conduct

ShoGinn commented 5 months ago

The fix should be easy enough by creating a mutable array and replacing the entire components on change.