discordjs / RPC

A simple RPC client for Discord
MIT License
466 stars 191 forks source link

Issue with spread operator in client.js #74

Closed Lizard-King101 closed 4 years ago

Lizard-King101 commented 4 years ago

using type script the spread operator is not recognized as an operator thus creating this error

[14:54:37]  ionic-app-script task: "build"
[14:54:37]  Error: ./node_modules/discord-rpc/src/client.js Module parse failed: Unexpected token (637:8) You may need
            an appropriate loader to handle this file type. | return this.request(RPCCommands.GET_RELATIONSHIPS) |
            .then((o) => o.relationships.map((r) => ({ | ...r, | type: types[r.type], | }))); @
            ./node_modules/discord-rpc/src/index.js 6:10-29 @ ./src/providers/discord.ts @ ./src/app/app.module.ts @
            ./src/app/main.ts
Error: ./node_modules/discord-rpc/src/client.js
Module parse failed: Unexpected token (637:8)
You may need an appropriate loader to handle this file type.
|     return this.request(RPCCommands.GET_RELATIONSHIPS)
|       .then((o) => o.relationships.map((r) => ({
|         ...r,
|         type: types[r.type],
|       })));
 @ ./node_modules/discord-rpc/src/index.js 6:10-29
 @ ./src/providers/discord.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts
    at new BuildError (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at callback (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/@ionic/app-scripts/dist/webpack.js:121:28)
    at emitRecords.err (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/Compiler.js:265:13)
    at Compiler.emitRecords (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/Compiler.js:371:38)
    at emitAssets.err (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/Compiler.js:364:12)
    at next (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/Users/nicklabrecque/Documents/apps/Seige-Craft/node_modules/webpack/lib/Compiler.js:361:9)

update the getRelationships function to

getRelationships() {
    const types = Object.keys(RelationshipTypes);
    return this.request(RPCCommands.GET_RELATIONSHIPS)
      .then((o) => o.relationships.map((r) => Object.assign({}, r, {type: types[r.type]})));
  }
devsnek commented 4 years ago

you should upgrade your tooling

Lizard-King101 commented 4 years ago

you should make things more compatible. you don't know what my project is, you don't know my limitations. Its not like I just came on here and gave you big long log for you to figure out on your own, NO, I took the time to figure out what was causing the error FIXED IT and let you know about it. . . Update my tooling smh

devsnek commented 4 years ago

I only maintain this library for the current node LTS. I'm sorry if you're using something older, but that's not supported by this library.

Lizard-King101 commented 4 years ago

wow . . . just wow so you cant turn {...r, type: types[r.type]} into Object.assign({}, r, {type: types[r.type]})