sanketbajoria / ssh2-promise

ssh with promise/async await and typescript support
https://www.npmjs.com/package/ssh2-promise
MIT License
148 stars 25 forks source link

Typing of sftp methods missing #6

Closed Evanlec closed 6 years ago

Evanlec commented 6 years ago

Your sftp.d.ts file specifies the SFTP class type as:

export default class SFTP extends EventEmitter {
    ssh: SSH2Promise;
    constructor(ssh: SSH2Promise);
    createReadStream(): Promise<any>;
    createWriteStream(): Promise<any>;
}

However, this only tells the typescript compiler about EventEmitter methods, it does not indicate all of the SSH2 methods like 'readdir()', 'mkdir()', etc

I am wondering if you can simply import the SFTPWrapper interface from the SSH2 library type definition, here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/11b48a05a8c7f2fb931ae89886006b7e1ab420e7/types/ssh2/index.d.ts#L1247

Then simply have your SFTP class extend that interface, which should give you all the methods...although those are not promisified

sanketbajoria commented 6 years ago

@Evanlec Thanks for pointing out. Let me see, how could we include type information for sftp class

sanketbajoria commented 6 years ago

Added support for sftp Type information. https://github.com/sanketbajoria/ssh2-promise/commit/f6c9f7f708ec329d2a313e8d90ca65b3beeb4cad