Strict nulls for contrib/restore and contrib/views (#12044)

* strict nulls for contrib/restore and contrib/views

* remove unnecessary function

* compile error
This commit is contained in:
Anthony Dresser
2020-09-01 17:53:29 -07:00
committed by GitHub
parent 9dde80ce1c
commit d8dcc90857
13 changed files with 148 additions and 200 deletions

View File

@@ -26,9 +26,11 @@ const DE_RESTORE_COMMAND_ID = 'dataExplorer.restore';
// Restore
CommandsRegistry.registerCommand({
id: DE_RESTORE_COMMAND_ID,
handler: (accessor, args: TreeViewItemHandleArg) => {
const commandService = accessor.get(ICommandService);
return commandService.executeCommand(RestoreAction.ID, args.$treeItem.payload);
handler: async (accessor, args: TreeViewItemHandleArg) => {
if (args.$treeItem?.payload) {
const commandService = accessor.get(ICommandService);
return commandService.executeCommand(RestoreAction.ID, args.$treeItem.payload);
}
}
});

View File

@@ -39,9 +39,10 @@ export class RestoreAction extends Task {
});
}
runTask(accessor: ServicesAccessor, profile: IConnectionProfile): void | Promise<void> {
runTask(accessor: ServicesAccessor, withProfile?: IConnectionProfile): void | Promise<void> {
let profile = withProfile;
const configurationService = accessor.get<IConfigurationService>(IConfigurationService);
const previewFeaturesEnabled: boolean = configurationService.getValue('workbench')['enablePreviewFeatures'];
const previewFeaturesEnabled: boolean = configurationService.getValue<{ enablePreviewFeatures: boolean }>('workbench').enablePreviewFeatures;
if (!previewFeaturesEnabled) {
return accessor.get<INotificationService>(INotificationService).info(localize('restore.isPreviewFeature', "You must enable preview features in order to use restore"));
}