Getting TypeScript error ts(1128) and SyntaxError when using .setColor method in Discord bot

Help with Discord bot embed color error

I’m working on creating an embed for my Discord bot and running into a frustrating issue. When I try to execute my code, I keep getting this error message:

Declaration or statement expected.ts(1128)
SyntaxError: Unexpected token '.'
    at wrapSafe (node:internal/modules/cjs/loader:1018:16)
    at Module._compile (node:internal/modules/cjs/loader:1066:27)

The error points to the line where I’m trying to use .setColor('#53BBFF') on my embed object. I’m not sure what’s causing this syntax error. The code looks correct to me but obviously something is wrong with how I’m chaining the methods or structuring the embed creation.

Can someone help me figure out what’s going wrong here? I’ve been stuck on this for a while and can’t seem to identify the issue.

I’ve hit this exact error before - it’s usually an import or module setup issue. The ts(1128) plus module loader error means your TypeScript config doesn’t match your Discord.js version. First, run npm install @types/node and check your tsconfig.json has proper module resolution. Also verify you’re importing EmbedBuilder correctly from discord.js. If you’re on an older version, you might need MessageEmbed instead. The syntax error happens because TypeScript can’t recognize the Discord.js types, not because setColor is broken.

youve probably got a variable issue or missed a declaration somewhere. ts(1128) often points to something before your .setColor(). maybe u hit enter too early when coding? lol. just ensure that your embed var is set up right before using those methods.

This error usually isn’t from .setColor() itself - it’s from syntax issues in the lines above it. The TypeScript compiler can’t figure out where your statement ends. Check for missing semicolons or incomplete variable declarations above that line. Another common mistake is trying to chain .setColor() right after creating the embed without storing it in a variable first. You need something like const embed = new EmbedBuilder().setColor('#53BBFF') instead of having the method call just floating on its own line. The “unexpected token” error means the parser doesn’t know what object you’re calling setColor on.