Fix more node 12 typing errors

For #82514
This commit is contained in:
Matt Bierner
2019-11-04 15:11:54 -08:00
parent a97738297d
commit cd4d7e6c2b
5 changed files with 11 additions and 5 deletions
@@ -12,6 +12,7 @@ import { ExtHostDocumentData, setWordDefinitionFor } from 'vs/workbench/api/comm
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import * as TypeConverters from 'vs/workbench/api/common/extHostTypeConverters';
import * as vscode from 'vscode';
import { assertIsDefined } from 'vs/base/common/types';
export class ExtHostDocuments implements ExtHostDocumentsShape {
@@ -84,7 +85,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
if (!promise) {
promise = this._proxy.$tryOpenDocument(uri).then(() => {
this._documentLoader.delete(uri.toString());
return this._documentsAndEditors.getDocument(uri);
return assertIsDefined(this._documentsAndEditors.getDocument(uri));
}, err => {
this._documentLoader.delete(uri.toString());
return Promise.reject(err);
@@ -383,7 +383,7 @@ export class ExtHostDebugService implements IExtHostDebugService, ExtHostDebugSe
public async $substituteVariables(folderUri: UriComponents | undefined, config: IConfig): Promise<IConfig> {
if (!this._variableResolver) {
const [workspaceFolders, configProvider] = await Promise.all([this._workspaceService.getWorkspaceFolders2(), this._configurationService.getConfigProvider()]);
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders || [], this._editorsService, configProvider);
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders || [], this._editorsService, configProvider!);
}
let ws: IWorkspaceFolder | undefined;
const folder = await this.getFolder(folderUri);
@@ -783,7 +783,7 @@ export class ExtHostDebugService implements IExtHostDebugService, ExtHostDebugSe
}
return undefined;
}),
new Promise((resolve, reject) => {
new Promise<never>((resolve, reject) => {
const timeout = setTimeout(() => {
clearTimeout(timeout);
reject(new Error('timeout'));
@@ -72,6 +72,7 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
return nativeProcessSend.apply(process, args);
}
mainThreadConsole.$logExtensionHostMessage(args[0]);
return false;
};
}
@@ -1305,7 +1305,7 @@ export class SettingsEditor2 extends BaseEditor {
private _filterOrSearchPreferencesModel(filter: string, model: ISettingsEditorModel, provider?: ISearchProvider, token?: CancellationToken): Promise<ISearchResult | null> {
const searchP = provider ? provider.searchModel(model, token) : Promise.resolve(null);
return searchP
.then<ISearchResult>(null, err => {
.then<ISearchResult, ISearchResult | null>(undefined, err => {
if (isPromiseCanceledError(err)) {
return Promise.reject(err);
} else {
@@ -1321,7 +1321,7 @@ export class SettingsEditor2 extends BaseEditor {
this.telemetryService.publicLog('settingsEditor.searchError', { message, filter });
this.logService.info('Setting search error: ' + message);
}
return Promise.resolve(null);
return null;
}
});
}
@@ -74,18 +74,21 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
if (!stat.isDirectory()) {
return Promise.reject(SHELL_CWD_INVALID_EXIT_CODE);
}
return undefined;
}, async err => {
if (err && err.code === 'ENOENT') {
// So we can include in the error message the specified CWD
shellLaunchConfig.cwd = cwd;
return Promise.reject(SHELL_CWD_INVALID_EXIT_CODE);
}
return undefined;
});
const executableVerification = stat(shellLaunchConfig.executable!).then(async stat => {
if (!stat.isFile() && !stat.isSymbolicLink()) {
return Promise.reject(stat.isDirectory() ? SHELL_PATH_DIRECTORY_EXIT_CODE : SHELL_PATH_INVALID_EXIT_CODE);
}
return undefined;
}, async (err) => {
if (err && err.code === 'ENOENT') {
let cwd = shellLaunchConfig.cwd instanceof URI ? shellLaunchConfig.cwd.path : shellLaunchConfig.cwd!;
@@ -96,6 +99,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
return Promise.reject(SHELL_PATH_INVALID_EXIT_CODE);
}
}
return undefined;
});
Promise.all([cwdVerification, executableVerification]).then(() => {