Closed
Description
TypeScript Version: v4.2.0-dev.20201119. Also impacts: 4.1.2. Does not impact: 4.1.0-beta, 4.0.5
Search Terms:
callbackify expected arguments optional default
Code
import util from 'util';
function functionWithDefaultArgReturnsPromise(arg1: number, arg2: string, arg3: boolean = false): Promise<number> {
return new Promise<number>((resolve, reject) => {
// do something
});
}
const functionWithDefaultArgHasCallBack = util.callbackify(functionWithDefaultArgReturnsPromise)
functionWithDefaultArgHasCallBack(1, 'two', true, (err: any, result: any) => {
// do something
// this callback function triggers error
//
// "Expected 3 arguments, but got 4.(2554)"
//
// in the v4.2.0-dev.20201119 (nightly at the time in the playground),
// but not with 4.1.0-beta in the playground, but I do see it on 4.1.2 locally as well as the last release candidate.
});
Expected behavior:
No error, no red squiggly lines
Actual behavior:
Error "Expected 3 arguments, but got 4.(2554)" occurs with red squiggly underlines on the callbackified function.
Related Issues:
No related issue found.