Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type errors on build #10078

Closed
Mohammad-Orabi opened this issue Jan 8, 2024 · 5 comments
Closed

Type errors on build #10078

Mohammad-Orabi opened this issue Jan 8, 2024 · 5 comments

Comments

@Mohammad-Orabi
Copy link

Mohammad-Orabi commented Jan 8, 2024

Which package is this bug report for?

discord.js

Issue description

Just installed discord.js and directly getting type errors from the library node_modules

TS Config:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "dist",

    "sourceMap": true,
    "strict": true,
    "paths": {
      "~/*": ["./src/*"]
    },

    "target": "es2020",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "typeRoots": ["node_modules/@types", "src/types"]
  },
  "compileOnSave": true,

  "include": ["src", "Public", "src/credentials/near-credentials"],
  "exclude": ["src/contracts"],

  "rootDir": "./src"
}

Error:

node_modules/discord.js/typings/index.d.ts(1210,21): error TS1139: Type parameter declaration expected.
node_modules/discord.js/typings/index.d.ts(1210,27): error TS1435: Unknown keyword or identifier. Did you mean 'type'?
node_modules/discord.js/typings/index.d.ts(1210,32): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
node_modules/discord.js/typings/index.d.ts(1211,9): error TS1005: ')' expected.
node_modules/discord.js/typings/index.d.ts(1211,11): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
node_modules/discord.js/typings/index.d.ts(1212,13): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1213,18): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1213,29): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1213,34): error TS1011: An element access expression should take an argument.
node_modules/discord.js/typings/index.d.ts(1214,3): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1214,4): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1225,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1225,21): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1225,32): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1226,9): error TS1005: ')' expected.
node_modules/discord.js/typings/index.d.ts(1227,13): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1227,14): error TS1134: Variable declaration expected.
node_modules/discord.js/typings/index.d.ts(1228,17): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1228,18): error TS1134: Variable declaration expected.
node_modules/discord.js/typings/index.d.ts(1228,29): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1228,33): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1229,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1229,4): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1240,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1240,24): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1240,42): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1240,49): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1241,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1241,24): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1241,43): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1241,53): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1242,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1242,25): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1242,43): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1242,50): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1243,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1243,25): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1243,44): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1243,54): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1244,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1244,24): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1244,42): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1244,49): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1245,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1245,24): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1245,43): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1245,53): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1246,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1246,22): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1246,40): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1246,47): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1247,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1247,22): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1247,41): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1247,51): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1248,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1248,24): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1248,33): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1249,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1249,22): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1249,40): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1249,47): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1250,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1250,22): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1250,41): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1250,51): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1251,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1251,28): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1251,46): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1251,53): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1252,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1253,9): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1254,14): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1255,4): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1256,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1257,9): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1258,13): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1259,4): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1260,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1261,9): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1262,14): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1263,4): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1264,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1264,25): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1264,43): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1264,50): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1265,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1265,25): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1265,44): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1265,54): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1266,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1266,28): error TS1005: ',' expected.
node_modules/discord.js/typings/index.d.ts(1266,35): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1267,3): error TS1128: Declaration or statement expected.
node_modules/discord.js/typings/index.d.ts(1267,29): error TS1109: Expression expected.
node_modules/discord.js/typings/index.d.ts(1267,39): error TS1005: ';' expected.
node_modules/discord.js/typings/index.d.ts(1268,1): error TS1128: Declaration or statement expected.

Code sample

No response

Versions

"discord.js": "^14.14.1",
   "typescript": "^5.3.3",
   "node": 18

Issue priority

High (immediate attention needed)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

@Jiralite
Copy link
Member

Jiralite commented Jan 8, 2024

This definitely looks like you are not using TypeScript 5+. You have a version clash somewhere. You need to resolve it.

@Mohammad-Orabi
Copy link
Author

@Jiralite
tsc --version
Version 5.3.3
npx tsc --version
Version 5.3.3

what do you exactly mean by version clash?

@didinele
Copy link
Member

didinele commented Jan 8, 2024

How are you running tsc to actually produce the error provided, just tsc?

@Mohammad-Orabi
Copy link
Author

@didinele I just changed from this at the moment
"dev": " npx tsc-watch --onFirstSuccess "nodemon dist/index.js"",
to this
"dev": "concurrently "tsc -w" "nodemon dist/index.js"",

testing now I think this resolved the issue

@Jiralite
Copy link
Member

Jiralite commented Jan 8, 2024

Just to be clear, these errors are from not understanding const type parameters (duplicate of #9783), introduced with TypeScript 5.0. Your version was not what you thought it to be when your code was compiled.

@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants