Skip to content

Commit

Permalink
refactor: constructMethod -> construct
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxuum committed Aug 5, 2024
1 parent 402290e commit 4441dfa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DEFAULT_CONFIG: SharedConfig = {
error: "An error occurred.",
notFound: "Command not found.",
},
constructCommand: (ctor) => {
construct: (ctor) => {
const obj = setmetatable({}, ctor as never) as object;
const result = (obj as { constructor(): unknown }).constructor();
assert(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/core/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export abstract class BaseRegistry<
MetadataKey.Guard,
) ?? [];

const instance = this.config.constructCommand(commandClass);
const instance = this.config.construct(commandClass);
for (const property of DecoratorMetadata.getOwnProperties(commandClass)) {
// Get decorator data
const options = DecoratorMetadata.getOwnMetadata<CommandOptions>(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface SharedConfig {
logLevel: CenturionLogLevel;
guards: CommandGuard[];
messages: CommandMessages;
constructCommand: (ctor: new (...args: never[]) => object) => object;
construct: (ctor: new (...args: never[]) => object) => object;
defaultContextState?: defined;
}

Expand Down

0 comments on commit 4441dfa

Please sign in to comment.