Use a proper Map for ICommandsMap

Changes the `ICommandsMap` type to be a proper map. This can help catch type errors and also gets us closer to being able to disable the tsconfig suppressImplicitAnyIndexErrors workaround
This commit is contained in:
Matt Bierner
2019-07-01 17:32:12 -07:00
parent 612901a9e9
commit de320f4061
8 changed files with 43 additions and 47 deletions

View File

@@ -36,10 +36,9 @@ export class MainThreadCommands implements MainThreadCommandsShape {
return this._proxy.$getContributedCommandHandlerDescriptions().then(result => {
// add local commands
const commands = CommandsRegistry.getCommands();
for (let id in commands) {
let { description } = commands[id];
if (description) {
result[id] = description;
for (const [id, command] of commands) {
if (command.description) {
result[id] = command.description;
}
}
@@ -79,7 +78,7 @@ export class MainThreadCommands implements MainThreadCommandsShape {
}
$getCommands(): Promise<string[]> {
return Promise.resolve(Object.keys(CommandsRegistry.getCommands()));
return Promise.resolve([...CommandsRegistry.getCommands().keys()]);
}
}