Basically, this error suddenly appeared after I updated all my NPM dependencies in the project and this affected the situation (likely particularly glob
or typescript
).
The fragment of code below comes from a program, used in a Discord.js bot for importing and registering commands for file paths.
import { glob } from 'glob';
import { promisify } from 'util';
const globPromise = promisify(glob);
const slashCommandFiles = await globPromise(
`${__dirname}/../Commands/Slash/*/*{.ts,.js}`
);
slashCommandFiles.forEach(async (filePath) => {
const command: CommandType = await this.importFile(filePath);
if (!command.name) return;
this.commands.set(command.name, command);
commands.push(command);
});
Error message:
Expected 2 arguments, but got 1.ts(2554)
util.d.ts(1054, 141): An argument for 'arg2' was not provided.
I still cannot figure out what kind of a second argument...
Node version: 19.6.0
Dependencies: "glob": "^10.1.0", "@types/glob": "^8.1.0", "@types/node": "^18.15.11", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", "typescript": "^5.0.4"