From 62f618c5f3d18a9683c4495f54882503c5d20b93 Mon Sep 17 00:00:00 2001 From: Daniel Gronberg Date: Tue, 27 Feb 2018 16:45:15 +0100 Subject: [PATCH] Added null as valid argument type to ssh2-sftp-client::get --- types/ssh2-sftp-client/index.d.ts | 2 +- types/ssh2-sftp-client/ssh2-sftp-client-tests.ts | 3 ++- types/ssh2-sftp-client/tsconfig.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/ssh2-sftp-client/index.d.ts b/types/ssh2-sftp-client/index.d.ts index a91725d7a4..a0133961d8 100644 --- a/types/ssh2-sftp-client/index.d.ts +++ b/types/ssh2-sftp-client/index.d.ts @@ -10,7 +10,7 @@ export = sftp; declare class sftp { connect(options: ssh2.ConnectConfig): Promise; list(remoteFilePath: string): Promise; - get(remoteFilePath: string, useCompression?: boolean, encoding?: string): Promise; + get(remoteFilePath: string, useCompression?: boolean, encoding?: string | null): Promise; put(input: string | Buffer | NodeJS.ReadableStream, remoteFilePath: string, useCompression?: boolean, encoding?: string): Promise; mkdir(remoteFilePath: string, recursive?: boolean): Promise; rmdir(remoteFilePath: string, recursive?: boolean): Promise; diff --git a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts index a8c774c5d3..67d2d35826 100644 --- a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts +++ b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts @@ -12,7 +12,8 @@ client.connect({ client.list('/remote/path').then(() => null); client.get('/remote/path').then(stream => stream.read(0)); -client.get('/remote/path', true, 'binary').then(stream => stream.read(0)); +client.get('/remote/path', true, 'utf8').then(stream => stream.read(0)); +client.get('/remote/path', true, null).then(stream => stream.read(0)); client.put('/local/path', '/remote/path').then(() => null); client.put(new Buffer('content'), '/remote/path').then(() => null); diff --git a/types/ssh2-sftp-client/tsconfig.json b/types/ssh2-sftp-client/tsconfig.json index 809639cd51..d714a8d1b4 100644 --- a/types/ssh2-sftp-client/tsconfig.json +++ b/types/ssh2-sftp-client/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [