-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
Bug Report
π Search Terms
error, arguments, overloads
β― Playground Link
Playground link with relevant code
π» Code
Reduced from https://github.com/elibarzilay/process-tracing/blob/59a790c839258ee737481edad0a614f094a1d68c/index.js
import fs = require("fs");
import stream = require("stream");
import util = require("util");
import zlib = require("zlib");
declare function split(matcher: RegExp, mapper: (line: string) => any): stream.Transform;
declare function test(x: any, y: () => string): string | undefined;
declare function jsonTransform(t: typeof test): stream.Transform;
declare function disp(x: any): string;
declare const input: string;
declare const output: string;
const pipeline = util.promisify(stream.pipeline);
async function processFile(fastMode: boolean) {
await pipeline(
fs.createReadStream(input),
...(/\.gz$/.test(input) ? [zlib.createGunzip()]
: /\.br$/.test(input) ? [zlib.createBrotliDecompress()]
: []),
fastMode
? split(/,?\r?\n/, x => x.length > 1 ? test(JSON.parse(x), () => x) : undefined)
: jsonTransform(test),
async function* (inp) {
for await (const x of inp) yield disp(x);
yield "\n]\n";
},
...(/\.gz$/.test(output) ? [zlib.createGzip()]
: /\.br$/.test(output) ? [zlib.createBrotliCompress()]
: []),
fs.createWriteStream(output)
);
}There are several weird things going on here:
fs.createWriteStream(output)is squiggled and the error produced isExpected at least 1 arguments, but got 6 or more.There are no elaborations. I have no idea what's actually wrong.- As @minestarks points out, it's not clear how any numbers could be substituted into this error template to make the statement sensible.
- In 4.1.5 or 4.2.0-dev, if you comment out the
async function *argument, the new error isNo overload expects 4 arguments, but overloads do exist that expect either 4 or Infinity arguments.The phrasing "4 or Infinity" is strange, the value 4 is both expected and not expected, and it's not clear where 4 actually comes from (maybe it assumes each spread is empty?). - In 4.2.0-dev.20210219, the squiggle range is reduced to only some of the arguments and the error is
Expected at least 1 arguments, but got 4 or more.
ExE-Boss
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this