Open cinderblock opened 1 year ago
Adding to this confusion... the types for SSH2Promise.shell()
seem incomplete.
TypeScript server thinks it only takes 1 argument of type any
, from the BaseSSH2Promise
type, but it the base implementation takes 2 arguments. It looks like the implementation here doesn't allow using the second argument: https://github.com/sanketbajoria/ssh2-promise/blob/b05272def4b4ac9c4575fec649d0ede078fbd2f3/src/sshConnection.ts#L65-L71
I'm trying to use this package as described in the readme:
Some functions, like
.sftp()
, are typed properly and chained calls work as expected:But other functions get
any
types inferred.Both
opts
ands
haveany
type according to my TypeScript language server.Looking at the source code, I see that
sftp()
has a typeSFTP
inSSH2Promise
class type, and many of the types, and extendsBaseSSH2Promise
which has mostlyany
types. I also see theSSHConnection
type which does seem to have the more strict types that I'd like to use, but it's not clear how to use that class "correctly".If feels like much of the desired types are in the source code but that they're just not quite linked to each other properly. Do we need another round of #55? I see some other discussions of this issue specifically in #12 but that has been closed and merged. Should these issues still be happening or am I doing something stupid? Or maybe the readme should be updated to suggest using
new SSH2Promise.SSH()
instead?But using
SSH2Promise.SSH
doesn't have the same Promise versions of the sftp() commands...