From f044bb42a0fe087a7230678b01377c41384fd332 Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Thu, 19 Mar 2020 15:36:34 +0100 Subject: [PATCH] Fix source files to adhere to stricter TS type checking --- src/connect.ts | 8 ++++++-- src/sshFileSystem.ts | 2 +- src/toPromise.ts | 2 +- webview/src/FieldTypes/base.tsx | 2 +- webview/src/FieldTypes/dropdown.tsx | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/connect.ts b/src/connect.ts index 00b8d2c..be40923 100644 --- a/src/connect.ts +++ b/src/connect.ts @@ -147,6 +147,10 @@ export async function createSocket(config: FileSystemConfig): Promise ssh.destroy()); resolve(channel); @@ -159,9 +163,9 @@ export async function createSocket(config: FileSystemConfig): Promise(func: (cb: (err: Error | null, res?: T) => void) => boolean): Promise { + public continuePromise(func: (cb: (err: Error | null | undefined, res?: T) => void) => boolean): Promise { return new Promise((resolve, reject) => { const exec = () => { this.waitForContinue = false; diff --git a/src/toPromise.ts b/src/toPromise.ts index b2f84d7..5e2ba58 100644 --- a/src/toPromise.ts +++ b/src/toPromise.ts @@ -1,5 +1,5 @@ -export type toPromiseCallback = (err: Error | null, res?: T) => void; +export type toPromiseCallback = (err: Error | null | undefined, res?: T) => void; export async function toPromise(func: (cb: toPromiseCallback) => void): Promise { return new Promise((resolve, reject) => { try { diff --git a/webview/src/FieldTypes/base.tsx b/webview/src/FieldTypes/base.tsx index 79b0d3b..885b90a 100644 --- a/webview/src/FieldTypes/base.tsx +++ b/webview/src/FieldTypes/base.tsx @@ -50,7 +50,7 @@ export abstract class FieldBase extends React.Component extends FieldBase, State> { public renderInput() { const { newValue, open } = this.state; const { displayName } = this.props; - const display = newValue ? (displayName ? displayName(newValue) : newValue.toString()) : ''; + const display = newValue ? (displayName ? displayName(newValue) : `${newValue}`) : ''; return

{display}
@@ -35,7 +35,7 @@ export class FieldDropdown extends FieldBase, State> { const generateItem = (item: T, index: number) => { const style = displayStyle && displayStyle(item); return
  • - {displayName ? displayName(item) : item.toString()} + {displayName ? displayName(item) : `${item}`}
  • }; return