Skip to content

Commit 8359586

Browse files
authored
Ensure code compiles in strict mode (#4045)
For #611 Partial fixes for #611
1 parent 5a39283 commit 8359586

55 files changed

Lines changed: 245 additions & 154 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/webpack/webpack.extension.dependencies.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as webpack from 'webpack';
88
import { ExtensionRootDir } from '../constants';
99
import { getDefaultPlugins, nodeModulesToExternalize } from './common';
1010

11-
const entryItems: { [key: string]: string } = {};
11+
const entryItems: Record<string, string> = {};
1212
nodeModulesToExternalize.forEach(moduleName => {
1313
entryItems[`node_modules/${moduleName}`] = `./node_modules/${moduleName}`;
1414
});

src/client/activation/languageServer/analysisOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt
5656
}
5757
@traceDecorators.error('Failed to get analysis options')
5858
public async getAnalysisOptions(): Promise<LanguageClientOptions> {
59-
const properties: { [key: string]: {}} = {};
59+
const properties: Record<string, {}> = {};
6060
let interpreterData: InterpreterData | undefined;
6161
let pythonPath = '';
6262

src/client/common/utils/localize.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ export namespace UnitTests {
159159

160160
// Skip using vscode-nls and instead just compute our strings based on key values. Key values
161161
// can be loaded out of the nls.<locale>.json files
162-
let loadedCollection: { [index: string]: string } | undefined;
163-
let defaultCollection: { [index: string]: string } | undefined;
164-
const askedForCollection: { [index: string]: string } = {};
162+
let loadedCollection: Record<string, string> | undefined;
163+
let defaultCollection: Record<string, string> | undefined;
164+
const askedForCollection: Record<string, string> = {};
165165
let loadedLocale: string;
166166

167167
export function localize(key: string, defValue: string) {

src/client/common/variables/systemVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class SystemVariables extends AbstractSystemVariables {
9999
this._workspaceFolder = typeof workspaceFolder === 'string' ? workspaceFolder : __dirname;
100100
this._workspaceFolderName = Path.basename(this._workspaceFolder);
101101
Object.keys(process.env).forEach(key => {
102-
(this as any as { [key: string]: string | undefined })[`env:${key}`] = (this as any as { [key: string]: string | undefined })[`env.${key}`] = process.env[key];
102+
(this as any as Record<string, string | undefined>)[`env:${key}`] = (this as any as Record<string, string | undefined>)[`env.${key}`] = process.env[key];
103103
});
104104
}
105105

src/client/common/variables/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
import { Event, Uri } from 'vscode';
55

6-
export type EnvironmentVariables = Object & {
7-
[key: string]: string | undefined;
8-
};
6+
export type EnvironmentVariables = Object & Record<string, string | undefined>;
97

108
export const IEnvironmentVariablesService = Symbol('IEnvironmentVariablesService');
119

src/client/datascience/history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export class History implements IWebPanelMessageListener, IHistory {
542542
if (cells && this.applicationShell) {
543543

544544
const filtersKey = localize.DataScience.exportDialogFilter();
545-
const filtersObject: { [key: string]: string[] } = {};
545+
const filtersObject: Record<string, string[]> = {};
546546
filtersObject[filtersKey] = ['ipynb'];
547547

548548
// Bring up the open file dialog box

src/client/datascience/jupyter/jupyterExecution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const KernelSpecOutputRegEx = /^\s*(\S+)\s+(\S+)$/;
4747
export class JupyterExecution implements IJupyterExecution, Disposable {
4848

4949
private processServicePromise: Promise<IProcessService>;
50-
private commands: { [command: string]: IJupyterCommand } = {};
50+
private commands: Record<string, IJupyterCommand> = {};
5151
private jupyterPath: string | undefined;
5252
private usablePythonInterpreter: PythonInterpreter | undefined;
5353

src/client/datascience/jupyter/jupyterServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ export class JupyterServer implements INotebookServer, IAsyncDisposable {
434434
private combineObservables = (...args: Observable<ICell>[]): Observable<ICell[]> => {
435435
return new Observable<ICell[]>(subscriber => {
436436
// When all complete, we have our results
437-
const results: { [id: string]: ICell } = {};
437+
const results: Record<string, ICell> = {};
438438

439439
args.forEach(o => {
440440
o.subscribe(c => {

src/client/debugger/debugAdapter/DebugClients/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class DebugClientHelper {
1111
// Merge variables from both .env file and env json variables.
1212
const envFileVars = await this.envParser.parseFile(args.envFile);
1313
// tslint:disable-next-line:no-any
14-
const debugLaunchEnvVars: {[key: string]: string} = (args.env && Object.keys(args.env).length > 0) ? { ...args.env } as any : {} as any;
14+
const debugLaunchEnvVars: Record<string, string> = (args.env && Object.keys(args.env).length > 0) ? { ...args.env } as any : {} as any;
1515
const env = envFileVars ? { ...envFileVars! } : {};
1616
this.envParser.mergeVariables(debugLaunchEnvVars, env);
1717

src/client/debugger/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface IKnownLaunchRequestArguments extends ICommonDebugArguments {
5858
args: string[];
5959
cwd?: string;
6060
debugOptions?: DebugOptions[];
61-
env?: { [key: string]: string | undefined };
61+
env?: Record<string, string | undefined>;
6262
envFile: string;
6363
console?: ConsoleType;
6464
}

0 commit comments

Comments
 (0)