diff --git a/packages/commands/src/index.ts b/packages/commands/src/index.ts index b1d8d76a9..3957e2fa5 100644 --- a/packages/commands/src/index.ts +++ b/packages/commands/src/index.ts @@ -12,7 +12,7 @@ import { } from '@lumino/algorithm'; import { - JSONExt, ReadonlyJSONObject + JSONExt, ReadonlyPartialJSONObject } from '@lumino/coreutils'; import { @@ -168,7 +168,7 @@ class CommandRegistry { * @returns The display label for the command, or an empty string * if the command is not registered. */ - label(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + label(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.label.call(undefined, args) : ''; } @@ -183,7 +183,7 @@ class CommandRegistry { * @returns The mnemonic index for the command, or `-1` if the * command is not registered. */ - mnemonic(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): number { + mnemonic(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): number { let cmd = this._commands[id]; return cmd ? cmd.mnemonic.call(undefined, args) : -1; } @@ -191,7 +191,7 @@ class CommandRegistry { /** * @deprecated Use `iconClass()` instead. */ - icon(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + icon(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { return this.iconClass(id, args); } @@ -205,7 +205,7 @@ class CommandRegistry { * @returns The icon class for the command, or an empty string if * the command is not registered. */ - iconClass(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + iconClass(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.iconClass.call(undefined, args) : ''; } @@ -220,7 +220,7 @@ class CommandRegistry { * @returns The icon label for the command, or an empty string if * the command is not registered. */ - iconLabel(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + iconLabel(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.iconLabel.call(undefined, args) : ''; } @@ -235,7 +235,7 @@ class CommandRegistry { * @returns The caption for the command, or an empty string if the * command is not registered. */ - caption(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + caption(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.caption.call(undefined, args) : ''; } @@ -250,7 +250,7 @@ class CommandRegistry { * @returns The usage text for the command, or an empty string if * the command is not registered. */ - usage(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + usage(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.usage.call(undefined, args) : ''; } @@ -265,7 +265,7 @@ class CommandRegistry { * @returns The class name for the command, or an empty string if * the command is not registered. */ - className(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): string { + className(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): string { let cmd = this._commands[id]; return cmd ? cmd.className.call(undefined, args) : ''; } @@ -280,7 +280,7 @@ class CommandRegistry { * @returns The dataset for the command, or an empty dataset if * the command is not registered. */ - dataset(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): CommandRegistry.Dataset { + dataset(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): CommandRegistry.Dataset { let cmd = this._commands[id]; return cmd ? cmd.dataset.call(undefined, args) : {}; } @@ -295,7 +295,7 @@ class CommandRegistry { * @returns A boolean indicating whether the command is enabled, * or `false` if the command is not registered. */ - isEnabled(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): boolean { + isEnabled(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): boolean { let cmd = this._commands[id]; return cmd ? cmd.isEnabled.call(undefined, args) : false; } @@ -310,7 +310,7 @@ class CommandRegistry { * @returns A boolean indicating whether the command is toggled, * or `false` if the command is not registered. */ - isToggled(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): boolean { + isToggled(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): boolean { let cmd = this._commands[id]; return cmd ? cmd.isToggled.call(undefined, args) : false; } @@ -325,7 +325,7 @@ class CommandRegistry { * @returns A boolean indicating whether the command is visible, * or `false` if the command is not registered. */ - isVisible(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): boolean { + isVisible(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): boolean { let cmd = this._commands[id]; return cmd ? cmd.isVisible.call(undefined, args) : false; } @@ -343,7 +343,7 @@ class CommandRegistry { * The promise will reject if the command throws an exception, * or if the command is not registered. */ - execute(id: string, args: ReadonlyJSONObject = JSONExt.emptyObject): Promise { + execute(id: string, args: ReadonlyPartialJSONObject = JSONExt.emptyObject): Promise { // Reject if the command is not registered. let cmd = this._commands[id]; if (!cmd) { @@ -583,7 +583,7 @@ namespace CommandRegistry { * A type alias for a user-defined command function. */ export - type CommandFunc = (args: ReadonlyJSONObject) => T; + type CommandFunc = (args: ReadonlyPartialJSONObject) => T; /** * A type alias for a simple immutable string dataset. @@ -808,7 +808,7 @@ namespace CommandRegistry { /** * The arguments object passed to the command. */ - readonly args: ReadonlyJSONObject; + readonly args: ReadonlyPartialJSONObject; /** * The promise which resolves with the result of the command. @@ -866,7 +866,7 @@ namespace CommandRegistry { * * The default value is an empty object. */ - args?: ReadonlyJSONObject; + args?: ReadonlyPartialJSONObject; /** * The key sequence to use when running on Windows. @@ -916,7 +916,7 @@ namespace CommandRegistry { /** * The arguments for the command. */ - readonly args: ReadonlyJSONObject; + readonly args: ReadonlyPartialJSONObject; } /**