mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:30:44 +00:00
chore(lint): enable unnecessary type parameter rule
This commit is contained in:
@@ -10,14 +10,12 @@ export type CommandDescriptorCatalog<TDescriptor extends NamedCommandDescriptor>
|
||||
getCommandsWithSubcommands: () => string[];
|
||||
};
|
||||
|
||||
export function getCommandDescriptorNames<TDescriptor extends CommandDescriptorLike>(
|
||||
descriptors: readonly TDescriptor[],
|
||||
): string[] {
|
||||
export function getCommandDescriptorNames(descriptors: readonly CommandDescriptorLike[]): string[] {
|
||||
return descriptors.map((descriptor) => descriptor.name);
|
||||
}
|
||||
|
||||
export function getCommandsWithSubcommands<TDescriptor extends NamedCommandDescriptor>(
|
||||
descriptors: readonly TDescriptor[],
|
||||
export function getCommandsWithSubcommands(
|
||||
descriptors: readonly NamedCommandDescriptor[],
|
||||
): string[] {
|
||||
return descriptors
|
||||
.filter((descriptor) => descriptor.hasSubcommands)
|
||||
@@ -52,9 +50,9 @@ export function defineCommandDescriptorCatalog<TDescriptor extends NamedCommandD
|
||||
};
|
||||
}
|
||||
|
||||
export function addCommandDescriptorsToProgram<TDescriptor extends CommandDescriptorLike>(
|
||||
export function addCommandDescriptorsToProgram(
|
||||
program: Command,
|
||||
descriptors: readonly TDescriptor[],
|
||||
descriptors: readonly CommandDescriptorLike[],
|
||||
existingCommands: Set<string> = new Set(),
|
||||
): Set<string> {
|
||||
for (const descriptor of descriptors) {
|
||||
|
||||
@@ -46,8 +46,8 @@ export function resolveCommandGroupEntries<TDescriptor extends NamedCommandDescr
|
||||
}));
|
||||
}
|
||||
|
||||
export function buildCommandGroupEntries<TDescriptor extends NamedCommandDescriptor, TRegister>(
|
||||
descriptors: readonly TDescriptor[],
|
||||
export function buildCommandGroupEntries<TRegister>(
|
||||
descriptors: readonly NamedCommandDescriptor[],
|
||||
specs: readonly CommandGroupDescriptorSpec<TRegister>[],
|
||||
mapRegister: (register: TRegister) => CommandGroupEntry["register"],
|
||||
): CommandGroupEntry[] {
|
||||
|
||||
@@ -27,10 +27,10 @@ function getDeclaredCommandJsonMode(command: Command): JsonMode | null {
|
||||
|
||||
function commandSelectedJsonFlag(command: Command, argv: string[]): boolean {
|
||||
const commandWithGlobals = command as Command & {
|
||||
optsWithGlobals?: <T extends Record<string, unknown>>() => T;
|
||||
optsWithGlobals?: () => Record<string, unknown>;
|
||||
};
|
||||
if (typeof commandWithGlobals.optsWithGlobals === "function") {
|
||||
const resolved = commandWithGlobals.optsWithGlobals<Record<string, unknown>>().json;
|
||||
const resolved = commandWithGlobals.optsWithGlobals().json;
|
||||
if (resolved === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user