Skip to content

gunshi / definition / lazy

Function: lazy() ​

Define a lazy command with or without definition.

Param ​

A command loader function that returns a command definition

Param ​

An optional command definition

Call Signature ​

ts
function lazy<A>(loader): LazyCommand<{
  args: A;
  extensions: {
  };
}>;

Define a lazy command

Type Parameters ​

Type Parameter
A extends Args

Parameters ​

ParameterTypeDescription
loaderCommandLoader<{ args: A; extensions: { }; }>A command loader

Returns ​

LazyCommand<{ args: A; extensions: { }; }>

A lazy command loader

Call Signature ​

ts
function lazy<A>(loader, definition): LazyCommand<{
  args: A;
  extensions: {
  };
}>;

Define a lazy command with definition.

Type Parameters ​

Type Parameter
A extends Args

Parameters ​

ParameterTypeDescription
loaderCommandLoader<{ args: A; extensions: { }; }>A command loader function that returns a command definition
definitionCommand<{ args: A; extensions: { }; }>An optional command definition

Returns ​

LazyCommand<{ args: A; extensions: { }; }>

A lazy command that can be executed later

Call Signature ​

ts
function lazy<E>(loader): LazyCommand<{
  args: Args;
  extensions: E;
}>;

Define a lazy command

Type Parameters ​

Type Parameter
E extends ExtendContext

Parameters ​

ParameterTypeDescription
loaderCommandLoader<{ args: Args; extensions: E; }>A command loader

Returns ​

LazyCommand<{ args: Args; extensions: E; }>

A lazy command loader

Call Signature ​

ts
function lazy<E>(loader, definition): LazyCommand<{
  args: Args;
  extensions: E;
}>;

Define a lazy command with definition.

Type Parameters ​

Type Parameter
E extends ExtendContext

Parameters ​

ParameterTypeDescription
loaderCommandLoader<{ args: Args; extensions: E; }>A command loader function that returns a command definition
definitionCommand<{ args: Args; extensions: E; }>An optional command definition

Returns ​

LazyCommand<{ args: Args; extensions: E; }>

A lazy command that can be executed later

Call Signature ​

ts
function lazy<G>(loader): LazyCommand<G>;

Define a lazy command

Type Parameters ​

Type ParameterDefault type
G extends GunshiParamsConstraintDefaultGunshiParams

Parameters ​

ParameterTypeDescription
loaderCommandLoader<G>A command loader

Returns ​

LazyCommand<G>

A lazy command loader

Call Signature ​

ts
function lazy<G>(loader, definition): LazyCommand<G>;

Define a lazy command with definition.

Type Parameters ​

Type ParameterDefault type
G extends GunshiParamsConstraintDefaultGunshiParams

Parameters ​

ParameterTypeDescription
loaderCommandLoader<G>A command loader function that returns a command definition
definitionCommand<G>An optional command definition

Returns ​

LazyCommand<G>

A lazy command that can be executed later

Released under the MIT License.