Expect that the remaining generic type parameters that are not explicitly set, should be inferred from the function parameters.
const testsCallBack = {
test : function (callback : (err : any, result : string) => void)
}
function Prom<R extends any, M extends keyof O = any, O extends {} = any>(object : O, method : M) : void
const sftpWrapper = Prom<ssh2.SFTPWrapper>(testsCallBack, 'test'); // I would expect that the typing engine should infer the remain generics that are not explicitly set.
const sftpWrapper = Prom<ssh2.SFTPWrapper>(testsCallBack, 'tet');// Compiler Error
const sftpWrapper = Prom(ssh2, 'fastGet');// returns a good implementation of the types library
Also see post regarding top type unknown, which could also fix this problem, basically comes down to this being a type infer issues/bug in my opion.
#24439
Expect that the remaining generic type parameters that are not explicitly set, should be inferred from the function parameters.
Also see post regarding top type unknown, which could also fix this problem, basically comes down to this being a type infer issues/bug in my opion.
#24439